plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
15.98k stars 2.53k forks source link

X ticks orientation 90deg rotated in subplot #112

Closed guenp closed 3 months ago

guenp commented 10 years ago

Not sure how this happened.

screen shot 2014-08-21 at 7 21 26 pm

If it helps, here's my code:

fig = figure(figsize=(6,6))
for m in arange(0,len(data_IV_vs_T_vs_backgate)): 
    data = data_IV_vs_T_vs_backgate[m]
    [Rmatup, Vmatup, Imatup, Rmatdown, Vmatdown, Imatdown, T, B] = data
    ax = subplot(1,len(data_IV_vs_T_vs_backgate)+1,m+1)
    colormap = cm.jet
    colormap.set_gamma(1)
    color_cycle = [colormap(i) for i in np.linspace(0, 0.9, len(Rmatup))]
    ax.set_color_cycle(color_cycle)
    for (t,I,R) in zip(T, Imatup, Rmatup):
        label = 'T = ' + str(round(t*1e3)) + ' mK'
        plot(I,R,label=label)
    xlabel('$I_{dc} (A)$')
    ylabel('$R_{xx,ac} (\Omega)$')
    title(measnames[m])
width = 1000    # plot width in px
height = 500 # plot height in px
py.iplot_mpl(fig,filename='/superconductivity_XVII_LSM4_triton2/Rxxac_vs_Idc_vs_T_vs_Vbg', width=width, height=height)
theengineear commented 10 years ago

@guenp, this one i'll have to look into a little more, my gut feeling is that it's a plotly default thinking that there isn't enough room for the xaxis labels there, but it might also be in the python library. I'll give you a quick fix for this one:

fig = figure(figsize=(6,6))
for m in arange(0,len(data_IV_vs_T_vs_backgate)): 
    data = data_IV_vs_T_vs_backgate[m]
    [Rmatup, Vmatup, Imatup, Rmatdown, Vmatdown, Imatdown, T, B] = data
    ax = subplot(1,len(data_IV_vs_T_vs_backgate)+1,m+1)
    colormap = cm.jet
    colormap.set_gamma(1)
    color_cycle = [colormap(i) for i in np.linspace(0, 0.9, len(Rmatup))]
    ax.set_color_cycle(color_cycle)
    for (t,I,R) in zip(T, Imatup, Rmatup):
        label = 'T = ' + str(round(t*1e3)) + ' mK'
        plot(I,R,label=label)
    xlabel('$I_{dc} (A)$')
    ylabel('$R_{xx,ac} (\Omega)$')
    title(measnames[m])
width = 1000    # plot width in px
height = 500 # plot height in px
update = {"layout": {"xaxis1": {"tickangle": 0}, "xaxis2": {"tickangle": 0}}}
py.iplot_mpl(fig,
                  update=update,
                  filename='/superconductivity_XVII_LSM4_triton2/Rxxac_vs_Idc_vs_T_vs_Vbg',
                  width=width,
                  height=height)
theengineear commented 10 years ago

again, thanks for these issue threads! always extremely helpful.

guenp commented 10 years ago

@theengineear thanks, this fixed my problem.

gvwilson commented 3 months ago

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson