I have a simple dataframe and I'm running this simple code.
from plotly import graph_objects as go
fig = px.funnel(df, x='MeanDispatchedTime', y='Station_Name', color='MED_Type')
fig.show()
Is there some way to get the colors separate and distinct, so the red doesn't bleed into the lower levels? I'm looking at the documentation here.
https://plotly.com/python/funnel-charts/
Or, perhaps, this is completely the wrong chart to be using to tell the story...
Related
I am trying to plot both a scatterplot and a line plot, in the same figure. One is for objects and the other for lane markers. The outcome should be one figure with one time slider, that will update both objects and lane markers.
Current code
fig3 = go.Figure()
fig1 = px.line(data_frame=objects,x="Long", y="Lat",color="ObjID", animation_frame="rounded_time")
fig2 = px.scatter(data_frame=lanes,x="y", y="x", color="Location", animation_frame="rounded_time")
fig3 = go.Figure(data=(fig1.data + fig2.data))
This gives me a nice plot but missing the animation slider:
Is there any easy way to add plots to the same figure while retaining the animation_frame?
So, after a lot of googling I have found nothing on this. I think I have to use Plotly Graph Objects to achieve this.
So right now I am trying to learn how to use plotly go, having hard time finding any tutorials on plotly go, plenty on plotly express though..
I have been using the Altair python API for a Data Visualization project, and everything went smoothly until I wanted to add a radar chart to my app.
I could not find anything on Altair's python API documentation about radar charts, however there seems to be an entry about that in Altair's core documentation but I couldn't access it.
I saw that plotly had that feature but I would really have liked using only one plotting framework...
Is there really no way to make a radar chart with Altair in python ?
This is currently not implemented in VegaLite, you can see the discussion in these two issues and open a new one if you think there is a good case to be made for radar charts:
https://github.com/vega/vega-lite/issues/3805
https://github.com/vega/vega-lite/issues/408
In Altair you might be able to hack something together by layering multiple mark_arc charts with a fillOpacity=0 and a colored stroke (although I don't think this will work since I can't see any way to get right of the lines going towards the middle.
Here is an example of MACD plot using python.
https://code.luasoftware.com/tutorials/algo-trading/python-mplfinance-plot-yfinance-candle-chart-moving-average-macd-and-volume/
I'd like the result (including colors and crossover points, etc.) to be the same as that of tradingview.com
https://www.tradingview.com/script/NDH8bJow-MACD-Colors-Signals/
Could anybody show the python so that it is the same as that of tradingview.com?
Could anybody show the python so that it is the same as that of tradingview.com?
I don't think anyone is going to want to write your code for you.
However what I would recommend is that you work through the mplfinance tutorials on Customizing the Appearance of Your Plots and especially teach yourself about mplfinance styles which shows how to modify the overall color scheme of your plot. See also mplfinance style sheets reference.
For example, to achieve a color scheme similar to trading view you could use the "market colors" from style 'yahoo' and the combine that with mplfinance style 'nightclouds'. Something like this:
mc = mpf.make_marketcolors(base_mpf_style='yahoo')
s = mpf.make_mpf_style(base_mpf_style='nightclouds',marketcolors=mc)
Then when you call mpf.plot() specify kwarg style=s
hth
I have a basic bar chart with the x-axis having categorical values of countries. I want to give each bar, an image background of the country's flag, to make the chart more appealing also to eliminate the x-axis labels. I am currently using bokeh for my charts and I dont think it is possible via this. Any ideas for the same, maybe some other python libraries which might do the trick?
Thanks
Is it possible to make the plotly legends draggable? Currently I have my legend positioned outside the graph. I want to move it inside the graph, which is covered in the documentation, but I want to be able to make it draggable.
There is no direct way to drag the legend on a Plotly chart as far as I know.
You could find a workround by creating your legend in a HTML canvas and binding the onclick() function for each legend item to the Plotly PostMessage API restyle task.
There's a live example of the PostMessage API here which you should be able to hack apart. Let me know how you get on, this sounds interesting!
You can set "editable": True in the plot config.
https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L46-L54