question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Style plot background not working properly

See original GitHub issue

I am using holoviews with matplotlib and plotly backends.

import holoviews as hv
import numpy as np

from functools import reduce
hv.extension('plotly', 'matplotlib')

The problem is I specify bgcolor in the options of the final overlay. The final overlay is composed of many objects

The code i use to create the plot object looks like the following:

plot_obj = reduce(lambda x, y: x * y,
            [
                group.opts(hv.opts.Path3D(color=hv.Cycle(color_swatch)),
                           hv.opts.Scatter3D(color=hv.Cycle(color_swatch), size=10, marker='cross'))
                for group in groups
            ] + 
            [
                arrow.opts(hv.opts.Path3D(color='black'))
            ] +
            [
                prism_points.opts(hv.opts.Scatter3D(color=hv.Cycle(ms_color_swatch), size=4))
            ] +
            [
                unit_vectors.opts(hv.opts.Path3D(color='black'))
            ]
      )
plot_obj.opts(width=900, height=600, aspect=aspect, bgcolor='lightgray')

The result is a plot with a white background. Something is weird. print(plot_obj) :Overlay .Conductors.P1_c1_m0_m1 :Path3D [x,y,z] .Conductors.P2_c1_m0_m1 :Path3D [x,y,z] .Conductors.P3_c1_m0_m1 :Path3D [x,y,z] .Conductors.P4_c2_m0_m1 :Path3D [x,y,z] .Conductors.P5_c2_m0_m1 :Path3D [x,y,z] .Conductors.P6_c2_m0_m1 :Path3D [x,y,z] .Span_Points.I :Scatter3D [x,y,z] .Span_Points.II :Scatter3D [x,y,z] .Span_Points.III :Scatter3D [x,y,z] .Span_Points.IV :Scatter3D [x,y,z] .Span_Points.V :Scatter3D [x,y,z] .Span_Points.VI :Scatter3D [x,y,z] .Conductors.P1_c1_m1_m2 :Path3D [x,y,z] .Conductors.P2_c1_m1_m2 :Path3D [x,y,z] .Conductors.P3_c1_m1_m2 :Path3D [x,y,z] .Conductors.P4_c2_m1_m2 :Path3D [x,y,z] .Conductors.P5_c2_m1_m2 :Path3D [x,y,z] .Conductors.P6_c2_m1_m2 :Path3D [x,y,z] .Span_Points.VII :Scatter3D [x,y,z] .Span_Points.VIII :Scatter3D [x,y,z] .Span_Points.IX :Scatter3D [x,y,z] .Span_Points.X :Scatter3D [x,y,z] .Span_Points.XI :Scatter3D [x,y,z] .Span_Points.XII :Scatter3D [x,y,z] .Conductors.P1_c1_m2_m3 :Path3D [x,y,z] .Conductors.P2_c1_m2_m3 :Path3D [x,y,z] .Conductors.P3_c1_m2_m3 :Path3D [x,y,z] .Conductors.P4_c2_m2_m3 :Path3D [x,y,z] .Conductors.P5_c2_m2_m3 :Path3D [x,y,z] .Conductors.P6_c2_m2_m3 :Path3D [x,y,z] .Span_Points.XIII :Scatter3D [x,y,z] .Span_Points.XIV :Scatter3D [x,y,z] .Span_Points.XV :Scatter3D [x,y,z] .Span_Points.XVI :Scatter3D [x,y,z] .Span_Points.XVII :Scatter3D [x,y,z] .Span_Points.XVIII :Scatter3D [x,y,z] .Total_Station.I :Path3D [x,y,z] .Device_Points.Ms1 :Scatter3D [x,y,z] .Device_Points.Ms2 :Scatter3D [x,y,z] .Unit_Vectors.I :Path3D [x,y,z] .Unit_Vectors.II :Path3D [x,y,z]

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
philippjfrcommented, Apr 9, 2019

bgcolor is a plot option in holoviews, so it should be handled consistently across backends, but is probably not implemented.

0reactions
philippjfrcommented, Apr 29, 2019

I can’t reproduce any issue issue with 2D plots, the issue appears to be specific to plotly 3D plots.

@arabidopsis bgcolor controls the color of the background and the bottom layer takes precedence, if you want to color the boxes use color or fill_color.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plot style is not reflected accurately when plotting from AutoCAD
Plotting does not reflect the chosen plot style.
Read more >
python - How to change plot background color? - Stack Overflow
Use the set_facecolor(color) method of the axes object, which you've created one of the following ways: You created a figure and axis/es together...
Read more >
Publish in background throwing error about not finding the plot ...
Method 1: Launch all AutoCAD based Software and in Options, set the same plot style path to match the working one in your...
Read more >
Theming and templates in Python - Plotly
Over 25 examples of Theming and templates including changing color, size, log axes, and more in Python.
Read more >
Background Color Issue in LineChart #137 - GitHub
The gradient color works perfectly fine, but "backgroundColor" in the chartConfig, style, or chartConfig style, does not have any effect.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found