0
$\begingroup$

I'm using Plotly's graphic_objects.Histogram. I am trying to draw several histograms on the same plot. I'm not satisfied with the results of the 'overlay' option. I would like to draw histograms with no fill colour like in this example, with only the borders of the boxes drawn.

I was trying to fiddle with "marker.pattern" options but this doesn't seem to work. What would be the way to accomplish this, if this is possible?

$\endgroup$
3
  • 2
    $\begingroup$ Have you tried using the marker argument with a colour of zero alpha and only a line color? $\endgroup$
    – Oxbowerce
    Commented Jan 20, 2022 at 12:54
  • 1
    $\begingroup$ Can you add in your code and screen shot the picture you are getting, so that others can reproduce your example? $\endgroup$ Commented Jan 20, 2022 at 18:18
  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Commented Jan 20, 2022 at 18:18

1 Answer 1

1
$\begingroup$

Expanding on @Oxbowerce's suggestion, this gives an OK look (however, ideally I'd like to only use the 'roof' of each bin and not the vertical lines, I suspect that's not possible though)

fig = px.histogram(...)
for i in range(len(fig.data)):
    fig.data[i].marker.line.width = 3
    fig.data[i].marker.line.color = fig.data[i].marker.color
    fig.data[i].marker.color = "rgba(255, 255, 255, 0)"
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.