plotly / plotly.py

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

Config options for offline plots #399

Closed icaromedeiros closed 6 years ago

icaromedeiros commented 8 years ago

There is no way to set the 4th parameter in plotly.js when using offline plots as it is hardcoded in _plot_html (https://github.com/plotly/plotly.py/blob/master/plotly/offline/offline.py#L100)

config = {}
config['showLink'] = show_link
config['linkText'] = link_text
jconfig = json.dumps(config)
ispmarin commented 8 years ago

:+1: very relevant for offline plotting.

cudmore commented 8 years ago

I would like to hide the top plotly toolbar in my plotly offline plots (python). I see this is done with a 'config' option in other versions of the plotly library. How can I do this in plotly offline for python?

I am using this function in offline.py to make my plots:

def plot(figure_or_data,
         show_link=True, link_text='Export to plot.ly',
         validate=True, output_type='file',
         include_plotlyjs=True,
         filename='temp-plot.html',
         auto_open=True):
mrslezak commented 8 years ago

Same issue here - the config options for the modebar available in plotly.js aren't implemented in plotly.py https://plot.ly/javascript/configuration-options/ but I have a workaround here that may help the developers to integrate these options: http://stackoverflow.com/questions/36554705/adding-config-modes-to-plotly-py-offline-modebar

Rikorose commented 7 years ago

@yankev will this be merged into master?

gte620v commented 7 years ago

This seems to have broken offline mode, which is still expecting the old argument signature for _plot_html. See https://github.com/plotly/plotly.py/blob/4420d794ed58f31cd2c3a1f13558a9e9da798335/plotly/offline/offline.py#L311-L313

Compared to https://github.com/plotly/plotly.py/blob/4420d794ed58f31cd2c3a1f13558a9e9da798335/plotly/offline/offline.py#L163-L164

In this PR, I think line 311 should have been changed to:

    plot_html, plotdivid, width, height = _plot_html(
        figure_or_data, {'showLink':show_link, 'linkText':link_text}, validate,
        '100%', 525, global_requirejs=True)

Without this, even the most basic usage fails.

vctrd commented 7 years ago

Hi, I'm trying to use plotly with django and found this help: https://stackoverflow.com/questions/35092571/how-to-create-charts-with-plotly-on-django But the signature of _plot_html seems to have changed in plotly 2.0.11

Do you know if this has already been solved in a different version?

thanks

jonmmease commented 6 years ago

all config options are now supported in plotly.offline.plot and plotly.offline.iplot. They are not yet available in FigureWidget, see https://github.com/plotly/plotly.py/issues/1074.

bluprince13 commented 5 years ago

Is there a way to hide links when using cufflinks? Cufflinks iplot does not config as a parameter.

jonmmease commented 5 years ago

Hi @bluprince13, I don't know offhand, that would be something to bring up with the cufflinks project (https://github.com/santosjorge/cufflinks)