Change axis of plotly polar plot

不问归期 提交于 2019-12-11 10:37:23

问题


I am playing with Plotly tools using python and I have made a polar plot as seen below using some dummy data:

I would like to alter the axis so that the data I have (goes from around 20 to 50) is mapped to the entire 360° of the plot. Is there a way of doing this using a readymade command or do I need to write a function where you set the limits then map those numbers to degrees before changing axis labels. I have been looking through stack exchange but I can only find ways of changing it to radians.

import plotly.plotly as py
import plotly.graph_objs as go
import plotly.tools as tls
import pandas as pd
import numpy as np

df = pd.read_csv('ExampleOutput.csv')

trace1 = go.Scatter(
    r=df['TimeStamp'],
    t=df['AirTemperature'],
    mode='markers',
    name='Trial 1',
    marker=dict(
        color='rgb(27,158,119)',
        size=110,
        line=dict(
            color='white'
        ),
        opacity=0.7
    )
)




data = [trace1]
layout = go.Layout(
    title='Hobbs-Pearson Trials',
    font=dict(
        size=15
    ),
    plot_bgcolor='rgb(223, 223, 223)',
    angularaxis=dict(
        tickcolor='rgb(253,253,253)'
    )
)
fig = go.Figure(data=data, layout=layout)
plot_url = py.plot(fig, filename='polar-scatter')

回答1:


You can use the range attribute of angular axis to specify the range of your data. For your current example:

angularaxis=dict(
    tickcolor='rgb(253,253,253)',
    range=[20,50]
    )

Bonus Panel: range argument works for radialaxis as well. ;)



来源:https://stackoverflow.com/questions/35863268/change-axis-of-plotly-polar-plot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!