Category : plotly

My dataframe looks like this: title comments date post1 256 2021-07-19 11:48:39 post2 454 2021-07-18 22:14:41 post3 452 2019-05-14 19:38:11 post4 422 2018-06-14 16:38:12 post5 452 2017-03-04 17:18:11 I would like to make a line graph with x axis showing the year and y axis showing the amount of the posts posted that year (2 ..

Read more

I am using plotly in order to create a table figure. Here’s code from their website: import plotly.graph_objects as go fig = go.Figure(data=[go.Table(header=dict(values=[‘A Scores’, ‘B Scores’]), cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]])) ]) fig.show() Using fig.update_layout(width=300), I can shrink the size and get rid of white space. I am wondering how can I ..

Read more

I am trying to change the colour for Plotly plot and I am wondering on how to replace the colour scheme with three hex colour code like #32a852, #3261a8, #a83259. import plotly.express as px import numpy as np df = px.data.gapminder().query("year == 2007") fig = px.treemap(df, path=[px.Constant("world"), ‘continent’, ‘country’], values=’pop’, color=’lifeExp’, hover_data=[‘iso_alpha’], color_continuous_scale=’RdBu’, color_continuous_midpoint=np.average(df[‘lifeExp’], weights=df[‘pop’])) ..

Read more

I am trying to plot a timeline chart but they are stacking over each other. import pandas as pd import plotly.express as pex d1 = dict(Start= ‘2021-10-10 02:00:00’, Finish = ‘2021-10-10 09:00:00’, Task = ‘Sleep’) d2 = dict(Start= ‘2021-10-10 09:00:00’, Finish = ‘2021-10-10 09:30:00’, Task = ‘EAT’) d3 = dict(Start= ‘2021-10-10 09:30:00’, Finish = ‘2021-10-10 ..

Read more

I’m trying to make a choropleth figure and below is my sample code: import json import numpy as np import pandas as pd import plotly.express as px import plotly.graph_objects as go import plotly.io as pio pio.renderers.default=’browser’ vietnam_state=json.load(open("diaphantinhenglish.geojson","r")) df = pd.DataFrame({ ‘Name’: [‘Ha Noi’,’Ha Giang’,’Cao Bang’,’Bac Kan’,’Tuyen Quang’,’20211012′], ‘Count’: [3757,26,43,27,208,]}) #df Name Count 0 Ha Noi ..

Read more