简体   繁体   中英

Axes titles for a plot with cufflinks

I am trying to crate a surface plot of a pandas DataFrame using cufflinks.

I would like to have customized axes titles ( title_1 , title_2 and title_3 ) and a plot title with a math symbol. However the plot I get does not display my axes titles and in the plot title I only see the math symbol but not "My title with ". Why it does not work and how to fix it?

I am working in a Jupyter notebook.

import cufflinks as cf
cf.set_config_file(offline=True, dimensions=((1000,600)), theme = 'white')
pd.DataFrame([(1,2),(3,4)]).iplot(kind = 'surface', xTitle = "title_1", \
                              yTitle = "title_2" , zTitle = "title_3",\
                              title = r"My title with $\sigma$")

Since iplot returns a Plotly figure, you can provide a layout object, as follow (refer to Plotly documentation to understand how layout works):

import cufflinks as cf
cf.set_config_file(offline=True, dimensions=((1000,600)), theme = 'white')
pd.DataFrame([(1,2),(3,4)]).iplot(
    kind = 'surface',
    layout = {
        "scene": {
            "xaxis": {"title": "x axis"},
            "yaxis": {"title": "y axis"},
            "zaxis": {"title": "z axis"},
        },
        "title": r"My title with $\sigma$"
    })

在此处输入图像描述

As for why in the title you only see the rendered sigma and not the text, that is a bug with Plotly. Nothing we can do about it, for now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM