Closed ghost closed 4 years ago
Ah, I'm sorry our documentation is giving you such a hard time! The problem here is that .update_xaxes()
and .update_yaxes()
operate on 2d charts, not 3d charts like yours. You'll have to use update_scenes
which I now see isn't really anywhere in our docs, and is something we'll work on shortly (cc @emmanuelle @jdamiba)
I should add that the subplot "titles" themselves are actually annotations, stored in layout.annotations
and not actually indexable by row
/col
unfortunately, so you have to set those correctly in the make_subplots()
call otherwise they're pretty tricky to update.
Ah, I'm sorry our documentation is giving you such a hard time! The problem here is that
.update_xaxes()
and.update_yaxes()
operate on 2d charts, not 3d charts like yours. You'll have to useupdate_scenes
which I now see isn't really anywhere in our docs, and is something we'll work on shortly (cc @emmanuelle @jdamiba)I should add that the subplot "titles" themselves are actually annotations, stored in
layout.annotations
and not actually indexable byrow
/col
unfortunately, so you have to set those correctly in themake_subplots()
call otherwise they're pretty tricky to update.
You know, the thought passed through my mind that it could've been only applicable to 2D plots (-:
In any case... I got it to work now. Thanks a bunch, Nicolas! Awesome of you to reply so quickly.
If anyone gets to this topic somehow with the same problem here's how I fixed it.
OK, I'm glad you're unblocked! We'll get our docs updated to make this clearer 🙏
OK, I'm glad you're unblocked! We'll get our docs updated to make this clearer 🙏
Hello Nicolas, I just read through the question "ghost" encountered with subplots regarding .update_xaxes() etc. Do you perhaps know how to access the axes of a Scatterpolar plot?
Many thanks in advance and best wishes, Martin
@vontomar yes, you can use fig.update_polars()
to update polar axes.
@vontomar yes, you can use
fig.update_polars()
to update polar axes.
Thanks a lot Nicolas for your fast reply. I tried with fig.update_polars() which affects all Scatterpolar subplots in the widget. I am still trying to figure out how to address only one subplot? In my case, I just want to update the plot in row 3, column 4. I am currently trying this but I am not sure it will work:
polar34 = f.for_each_polar(f, row=3, col=4) polar34.update_layout(polar = dict(radialaxis = dict(angle=180, tickangle =-180, range = [0, 3]), angularaxis = dict(direction="clockwise", dtick = 30)))
If you have a hint I would be more than glad. Many thanks! Martin
You can just do f.update_polars(..., row=3, col=4)
, there is no need to use for_each_polar
.
You can just do
f.update_polars(..., row=3, col=4)
, there is no need to usefor_each_polar
.
Hi Nicolas Thank you so much, This works brilliantly. Best wishes, Martin
Hi there. I've spent the past few hours browsing the plotly documentation and stackoverflow to solve my problem, but I find nothing.
What I want to do, is update the layout of a specific subplot. If this is not possible, then updating all of them is fine as well.
I've tried -> https://plotly.com/python/subplots/ In the form of
fig.update_xaxes(title_text="xaxis 1 title", row=1, col=1)
But this did not work.I've also tried to update the layout by trying to set xaxis2, as some Stack Overflow users suggested, this just gave me a key error. Maybe this was an old functionality?
From -> https://plotly.com/python/3d-axes/ I've tried:
fig.update_layout(scene = dict( xaxis_title='X AXIS TITLE', yaxis_title='Y AXIS TITLE', zaxis_title='Z AXIS TITLE'), width=700, margin=dict(r=20, b=10, l=10, t=10))
This works, however it only updates the first subplot I have.
Essentially this is the code I have for adding the trace objects.
Then this is my attempt at editing the axes, yet this only updates the first plot.
This is my result, and it's really frustrating because I just want my axes labeled...
As you can probably see, the first plot is nicely zoomed out as well, however I have the exact same problem that when I update the layout, it only updates the first plot instead of all of them.
This is my make subplots code. While I'm glad that there's a subplot_titles argument, is there no functionality to do the same for the axes of the plots?
In another issue I saw one of the developers of Plotly reply that update_xaxes, and update_yaxes is the way to do this, but as I mentioned before this did not do anything for me. No errors, just the plots and no updated labels.
If anyone's knowledgeable in this, then thanks in advance.