Hi there,
I recently moved from the deprecated polar chart go.Scatter to go.Scatterpolar. In the deprecated version, there was a very useful possibility of setting the angular axis according to a given range:
angularaxis=dict( range = [0,24] )
I did not manage to make this work in the new version. It seems that we can personalize ticks using categories, but then then the angular scale becomes discrete… which I do not wish.
Is there a possibility to have a custom continuous scale for Scatterpolar, like in the previous version? A concrete example would be to represents data happening in the time of a day, with an angular scale going from 0h to 24h. More simply, maybe it would be useful to add “hours” as possible thetaunits in addition to “radians”, “degrees” and “gradients”.
Thanks
Really?!? The old polar renderer could do that? Oops, we weren’t aware of it while developing its replacement. Our apologies.
Sounds like you’re after a type: date
angular axis with a set period
of 24 hours. This is one of the most important open item listed in https://github.com/plotly/plotly.js/issues/2255.
Yes, that was possible, and a super cool feature actually
Thanks for the update! I guess I’ll wait for the implementation of a type: date
then.
Can you share an example of your old graph, to help us implement something similar for scatterpolar
?
Sure, here’s a very simplified version of the piece of Dash code I used to run:
import dash
import flask
import plotly
import plotly.graph_objs as go
import dash_html_components as html
import dash_core_components as dcc
server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server)
data_traces = []
for i in range(1,5):
data_traces += [ go.Scatter( r = [i], t = [24/i], mode='markers', name='x = ' + str(i), marker=dict( size=i*100) ) ]
layout = go.Layout( title='Coucou', font=dict( size=15, color = 'grey' ), plot_bgcolor='rgb(223, 223, 223)',angularaxis=dict( tickcolor='rgb(253,253,253)', range = [0,24] ),
radialaxis=dict( range =[ 0, 5 ] ), direction = "counterclockwise", showlegend = True )
app.layout = html.Div(children = [ dcc.Graph(id='graph-polar',style={ 'width' : '100%' }, figure = {'data': data_traces, 'layout': layout} ) ],
style={'width': '80%', 'fontFamily': 'Sans-Serif', 'margin-left': 'auto','margin-right': 'auto' }
)
if __name__ == '__main__':
app.run_server(debug=True)
Thanks
Sorry to revive this old topic, but any update on this issue? I would still need to use hours instead of radians on a polar chart. Alternatively, setting the ticks labels myself would also work, but this doesn’t seem possible either…