endangeredoxen / fivecentplots

A Python plotting analgesic
https://endangeredoxen.github.io/fivecentplots
11 stars 6 forks source link

Idea: Adding support for Plotly #36

Closed P-Kuca closed 1 year ago

P-Kuca commented 2 years ago

Hi, I love the fact that some of the the JMP capability had been comprehended within the project. I was wondering if there can be a possibility to extend capability to Plotly (not only Bokeh)?

Regards P Kuca

endangeredoxen commented 2 years ago

Thanks for the kind feedback. The idea was to have a basic api that can be applied to any plotting engine. I'm not a plotly user but I imagine it would be possible to incorporate if someone was inclined to do so. Feel free to give it a shot!

P-Kuca commented 2 years ago

HI Steve, Thanks for the feedback. I might be a bit dense today so I would appreciate if you can bare with me...When I run scripts as bellow (i.e. Jupter) it works great:   import plotly.express as px df = px.data.tips() %load_ext autoreload %autoreload 2 %matplotlib inline import fivecentplots as fcp import pandas as pd import numpy as np import os, sys, pdb

osjoin = os.path.join db = pdb.set_trace fcp.boxplot(df=df, y='tip', groups=['time', 'sex', 'day'], legend='smoker')

If I try to fcp.boxplot(df=df, y='tip', groups=['time', 'sex', 'day'], legend='smoker', engine='plt') i get: "Plotting engine "plt" is not supported" which is what I kind of expected

Were you saying that I would need to create the module for Plotly (like you build for Bokeh) or were you saying that there is a possibility to execute outright (if so I was not able to find instructions)? I can obviously extract and utilize created *.png but that would have lost any interactivity...

Thanks Dabiziv

endangeredoxen commented 2 years ago

Were you saying that I would need to create the module for Plotly (like you build for Bokeh)

Yes this is what I meant. You (or someone) would need to create a wrapper for plotly similar to engines.mpl or engines.bokeh that maps the api of plotly to what is used in fcp. Ultimately, how well this works will depend on what is possible natively with plotly itself. For example, if the boxplot capabilities of plotly are limited (for example, if there are no hooks to add custom grouping labels similar to the JMP variability chart) then you would be out of luck. Make sense?