All about the Graph Component - Python Dash Plotly

  Рет қаралды 29,424

Charming Data

Charming Data

Күн бұрын

Пікірлер: 101
@CharmingData
@CharmingData 4 жыл бұрын
Hey everyone, make sure you use Dash 1.16 or higher to run this app successfully. Keep practicing 💪 No se den por vencidos. If you benefitted from these tutorials and would like to show your appreciation and support the existence of this channel 🙌: www.patreon.com/charmingdata
@manalijain8362
@manalijain8362 4 жыл бұрын
Charming Data Thank you so very much for uploading such amazing tutorial videos every week!! You made Plotly Dash so interesting!!
@CharmingData
@CharmingData 4 жыл бұрын
@@manalijain8362 you're welcome @manali
@hakanyuceturk5989
@hakanyuceturk5989 Жыл бұрын
looking for the plotly dash tutorials all over the web couldn't find anything really good, you re the lifesaver man.
@wp4297
@wp4297 2 жыл бұрын
Two videos a day. Two brilliant videos. Thus, you have a new subscriber
@CharmingData
@CharmingData 2 жыл бұрын
Thanks for watching WP
@manueldominguezbecerra5577
@manueldominguezbecerra5577 3 жыл бұрын
Your contribution (not only this video) is a masterpiece tutorial. THANKS
@CharmingData
@CharmingData 3 жыл бұрын
Thank you @Manuel
@ptanisaro
@ptanisaro 2 жыл бұрын
I'm going to start with dash and your video tutorial makes me feel at ease. Thank You, Adam!
@CharmingData
@CharmingData 2 жыл бұрын
Thanks for watching, Pattreeya. Do you know how to code in python?
@ptanisaro
@ptanisaro 2 жыл бұрын
@@CharmingData Yes. :) I 'm going to employ dash and plotly to my project.
@CharmingData
@CharmingData 2 жыл бұрын
@@ptanisaro great. Good luck
@introspecticon
@introspecticon 3 жыл бұрын
Thanks for the great content. You are an excellent teacher.
@brunoevione
@brunoevione 4 жыл бұрын
Thank you, Adam! I was trying to find in the plotly documentation a way to update a chart when the user "hover-off" and the solution is sooooo easy hahaha! As usual, great job!
@CharmingData
@CharmingData 4 жыл бұрын
You're welcome @Bruno. I'd love to see some of your web apps that you build. 🤗
@naliu3399
@naliu3399 2 жыл бұрын
Your video is really amazing! I learnt a lot from them. Now I have a much better understanding on building interactive dashboards. Thank you so much!
@segad8479
@segad8479 2 жыл бұрын
Very clear and accurate presentation. Great help and many thanks.
@torinhodge
@torinhodge 2 жыл бұрын
Thank you for this incredibly helpful video. For others using Jupyter notebook and having trouble getting the Dash window to connect, I had to change the last line to app.run_server(debug=False). Cheers!
@xXProtatoXx
@xXProtatoXx 2 жыл бұрын
you are a hero
@Wonderfull_Hasti
@Wonderfull_Hasti Жыл бұрын
very very interesting🤩
@Saarkay
@Saarkay 3 жыл бұрын
Great Video! What if I want the hover action on both graphs and hovering on one changes the other?
@wiztech2732
@wiztech2732 Жыл бұрын
How to pull a section of pie chart ?
@CharmingData
@CharmingData Жыл бұрын
hi, You can try to go into the clickData of the pie chart and interact with that data: @app.callback( Output('dpdn2', 'style'), Input(component_id='pie-graph', component_property='clickData') ) def pie_chart_data(data): print(data) return {}
@hongweizhouwei
@hongweizhouwei 4 жыл бұрын
Look forwards to the Clientside Callbacks tutorial :)
@CharmingData
@CharmingData 4 жыл бұрын
Did you already build your own app, Michael?
@krutikkhillare3284
@krutikkhillare3284 3 жыл бұрын
can you please show how to put this graph in upload component.
@LifeWithSeb99
@LifeWithSeb99 3 жыл бұрын
Would you please make a video on how to style graph legends? Not much info on that
@its_me7363
@its_me7363 4 жыл бұрын
very informative video again from your side. How about a video of map using folium in Dash? Would love to see what we can do...with folium
@himanshujoshi8109
@himanshujoshi8109 2 жыл бұрын
Hi, I need an help with displaying "No Data" for the states which are not having any data. I need these states to be grayed and other to follow the color sequence of "reds". Thanks!
@ganeshlakshman2506
@ganeshlakshman2506 3 жыл бұрын
Thank you so much, Adam. Effort that you have put is impressive. Is there a way to remove the plotly logo/menu that appears on hover?
@CharmingData
@CharmingData 3 жыл бұрын
Hi @Ganesh, yes. You need to use the config prop of the dcc.graph(config={'displaylogo':False})
@ismafoot11
@ismafoot11 3 жыл бұрын
Hey do you give classes ? I'd be interested. Im working on several projects at the moment for Dash and I'd love your support
@CharmingData
@CharmingData 3 жыл бұрын
Hi Isma, I provide consulting on Dash. Feel free to write me at adam@charming-data.com
@ehangroenewald5783
@ehangroenewald5783 2 жыл бұрын
Is it possible to 'Clear' or 'reset' clickdata, it seems like once you clicked something it forever stay in that mode and I cannot return to the overview graph again?
@yuanyulim193
@yuanyulim193 2 жыл бұрын
Hi~Thanks for your share. Is that possible to get click data on a blank space (In the same graph)? I want to use it as a threshold point and change my graph appearance. Thank you!
@jsap1063050
@jsap1063050 3 жыл бұрын
Thank you so much for your videos, they have been so helpful for me. What should I do if I have a line chart where I want multi=True for inputs, but the line chart is connected to a pie chart with the hover data similar to your other examples?
@CharmingData
@CharmingData 3 жыл бұрын
Hi Shannon, it's hard to say without initial code written out. I recommend writing out some code while you try to create the app you want, and when you get stuck or get an error, share that with Plotly Forum, where the members will try to answer you.
@karimbouaziz9113
@karimbouaziz9113 2 жыл бұрын
Hi Adam, Thank you very much, Again a great video and an excellent explanation :) I have one question though, is it possible to disable the zoom function or any events that happen through the right click of the mouse? In the project which i'm working on, i have a plot with an inverted y-axis, when i zoom in with the right click and then double click to zoom out and have the primitive plot, the plot was inverted, this only happens when i use the right button of the mouse, everything is ok when using the left button Do you have a suggestion to solve this problem? Thank you in advance
@abhishekmarkundi3061
@abhishekmarkundi3061 3 жыл бұрын
Hi, I got a error like attempting to connect a callback input item to component "vs_interval" but no components with that Id exist in the layout "help"
@CharmingData
@CharmingData 3 жыл бұрын
Hi, are you using the exact same code from the video?
@teklehaimanotaman3150
@teklehaimanotaman3150 3 жыл бұрын
Hi Adam, impressive lectures. I have one question in your plot (y-axis). Instead of showing k representing 1000, would it be possible to make a number instead ( instead of 5k, 5000)?
@CharmingData
@CharmingData 3 жыл бұрын
Yes. I'm pretty sure that's possible with Plotly graph objects
@divyangpatel8803
@divyangpatel8803 2 жыл бұрын
Is there any provision in dash where we click on image and it pops out in full screen and click again to goto original size?
@CharmingData
@CharmingData 2 жыл бұрын
not that I know of. I haven't heard of that exist.
@divyangpatel8803
@divyangpatel8803 2 жыл бұрын
Okay. Thanks.
@mauliknaik9520
@mauliknaik9520 4 жыл бұрын
Hey Adam, thanks for putting across videos on Dash they are super useful. Can you guide on how we can use the clickData information to annotate the graph. In figure.add_annotions i have tried to use clicktoshow='onoff', so i can select multiple points to annotate. The points are getting selected with clicktoshow option, however, not getting any text or information related to the point. Can you help?
@CharmingData
@CharmingData 4 жыл бұрын
Hi @Maulik, it's hard to say without seeing the code. Feel free to send me your code and data. I'll try to take a look later this week, I should have a few minutes free. info@charmingdata.org
@syedumairhassankazmi6830
@syedumairhassankazmi6830 2 жыл бұрын
Hi, first and foremost thanks for the great content. Saw several of your videos. They were well defined and taught. Thanks. I made a dashboard with 4 charts and wanted all of them to filter each other. I easily used 1 chart to filter the rest but if i want all of them to filter each other, I need to use multiple for loops. For example, if hover_data1 and hover_data2 and hoverdata3 is None: then something, elif hov1 and hov2 none then this, elif hov1 and hov3 none, elif hov2 and hove3 none, elif hov1 none, elif hov2 none, elif hove3 none and finally else: . Is this the way to do it or is their a more efficient way? Hope i was able to explain my question. Thanks
@CharmingData
@CharmingData 2 жыл бұрын
hi Syed Umair Hassan, What if you do: if hover_data1: my_pie = px.pie(......) elif hover_data2: my_pie = px.pie(......) elif hover_data3: my_pie = px.pie(......) return my_pie Can you do something like that?
@syedumairhassankazmi6830
@syedumairhassankazmi6830 2 жыл бұрын
@@CharmingData I think this will throw an exception when i hover over one graph and then hover over another because now the condition will change to if hover 1 and hover 2 then:
@syedumairhassankazmi6830
@syedumairhassankazmi6830 2 жыл бұрын
What I had to do was like this. I made 3 graphs, bar , pie and map filter each other plus all the other charts. This is a code snippet of how these 3 graphs are effecting 4 cards def update_graph(clk_data_bar, clk_data_map, clk_data_pie, start_date, end_date): if ((clk_data_bar is None) & (clk_data_map is None) & (clk_data_pie is None)): mask = MASK( start_date, end_date) total_complaints, timely_formated , dispute_formated, deliever_formatted = cards(mask) return total_complaints, timely_formated , dispute_formated, deliever_formatted elif ((clk_data_bar is None) & (clk_data_map is None)): clp = clk_data_pie['points'][0]['label'] mask = MASK( start_date, end_date, cdp = clp) total_complaints, timely_formated , dispute_formated, deliever_formatted = cards(mask) return total_complaints, timely_formated , dispute_formated, deliever_formatted elif ((clk_data_map is None) & (clk_data_pie is None)): clb = clk_data_bar['points'][0]['y'] mask = MASK( start_date, end_date, cdb = clb) total_complaints, timely_formated , dispute_formated, deliever_formatted = cards(mask) return total_complaints, timely_formated , dispute_formated, deliever_formatted elif ((clk_data_pie is None) & (clk_data_bar is None)): clm = clk_data_map['points'][0]['location'] mask = MASK( start_date, end_date, cdm = clm) total_complaints, timely_formated , dispute_formated, deliever_formatted = cards(mask) return total_complaints, timely_formated , dispute_formated, deliever_formatted elif clk_data_bar is None: clm = clk_data_map['points'][0]['location'] clp = clk_data_pie['points'][0]['label'] mask = MASK( start_date, end_date, cdm = clm, cdp = clp) total_complaints, timely_formated , dispute_formated, deliever_formatted = cards(mask) return total_complaints, timely_formated , dispute_formated, deliever_formatted elif clk_data_map is None: clb = clk_data_bar['points'][0]['y'] clp = clk_data_pie['points'][0]['label'] mask = MASK( start_date, end_date, cdb = clb, cdp = clp) total_complaints, timely_formated , dispute_formated, deliever_formatted = cards(mask) return total_complaints, timely_formated , dispute_formated, deliever_formatted elif clk_data_pie is None: clm = clk_data_map['points'][0]['location'] clb = clk_data_bar['points'][0]['y'] mask = MASK( start_date, end_date, cdb = clb, cdm = clm) total_complaints, timely_formated , dispute_formated, deliever_formatted = cards(mask) return total_complaints, timely_formated , dispute_formated, deliever_formatted else: clb = clk_data_bar['points'][0]['y'] clm = clk_data_map['points'][0]['location'] clp = clk_data_pie['points'][0]['label'] mask = MASK( start_date, end_date, cdb = clb, cdm = clm, cdp = clp) total_complaints, timely_formated , dispute_formated, deliever_formatted = cards(mask) return total_complaints, timely_formated , dispute_formated Code is a bit hard to read because of the functions I made plus youtube isn't letting me post my github repository, the comments gets deleted -_-. Btw thanks for the reply and these videos. Also, what should I do if want to highlight the point i have clicked or hovered on? Because if it doesn't get highlighted like it does in tableau/ power bi then users tends to forget which points are selected.
@dianaamiri9520
@dianaamiri9520 4 жыл бұрын
hi, thanks a lot for your videos, very helpful. However I am a bit confused, if I want to learn to build a dashboard with dash plotly which playlist I should start with?
@CharmingData
@CharmingData 4 жыл бұрын
Hi @Diana I recommend the playlist Connecting Graphs to Components: kzbin.info/aero/PLh3I780jNsiSDHCReNVtgPC1WkqduZA5R
@dianaamiri9520
@dianaamiri9520 4 жыл бұрын
@@CharmingData thank you
@jboch98
@jboch98 4 жыл бұрын
Hi Adam, thank you for the interesting video. Can you tell me something about choosing a column from the legend that belongs to the graph. Example: I have multiple columns and I want the title of my y-Axes to change if selecting another column from the legend. Thanks in advance!
@CharmingData
@CharmingData 4 жыл бұрын
Hi Julian, Try to use the restyleData parameter that belongs to the dcc.Graph(). This will allow to read the legend item that is being clicked on. Then, you can use that in the callback to return a title of the y-axis in the Output. For example: @app.callback( Output(component_id='anothergraph', component_property='figure'), Input(component_id='my-graph', component_property='restyleData'), ) def update_side_graph(data): print(data) fig = px.line(df, x=..., y=...) fig.update_layout(yaxis=dict(title=data)) return fig The last part "yaxis=dict(title=data)" you will have to customize and change a little because the data has to be filtered.
@richardtarrillo1597
@richardtarrillo1597 Жыл бұрын
Hello Adam. country color There are times when the line graph legend does not coincide with the pie graph legend. thanks from Peru.
@richardtarrillo1597
@richardtarrillo1597 Жыл бұрын
px.pie(data_frame=dff2,values='pop',names='country',color='country',...
@CharmingData
@CharmingData Жыл бұрын
@@richardtarrillo1597 hi there, what do you mean they do not coincide?
@skywankeryoupi
@skywankeryoupi 3 жыл бұрын
Thank you so much for all your great tutorials it helped a lot! I'm trying to integrate a shap waterfall graph that would update with a callback into my dash application, but it seems impossible to do it. Does anyone know how to do that? Thanks a lot!
@ayacine9496
@ayacine9496 4 жыл бұрын
Thank you verry much!! but i think there is a problem in the code, it seems that the display remains on the last value selected and not on the starting value. How to do if nothing is selected to return to the start value
@CharmingData
@CharmingData 4 жыл бұрын
Hi @Ayacine, what do you mean the display remains on the last value selected? Are you referring to the dropdown, the pie, or the line chart? And what is the starting value?
@ayacine9496
@ayacine9496 4 жыл бұрын
@@CharmingData at the bigining the pie chart popoulation is for 1952. When you hover data in the line chart this value change but when you stop hover data the value don't come back to 1952 but still stay at the last value hovered at the line chart. I have a similar problem in my dashboard when i stop hover, the graphics of my dashboard still stay filtered at the last value hovered and want my graphics to be no longer filtered when i stop hover.
@CharmingData
@CharmingData 4 жыл бұрын
@@ayacine9496 Hi Ayacine, Add the clear-on-hover parameter to your dcc.graph, like this: dcc.Graph(id='my-graph', clear_on_unhover=True) Let me know if it worked for you.
@ayacine9496
@ayacine9496 4 жыл бұрын
​Hi@@CharmingData, it works very fine for me, Thank you very much for your help
@ziyancheng8903
@ziyancheng8903 3 жыл бұрын
Hi Adam. thanks for posting your videos! I learned a lot. I saw you have parsed hov_year using hov_data['points'][0]['x'].... I have a question, currently I am using plotly express timeline to create a figure of gannt chart. by px.timeline(df, x_start=timestamp, x_end=timestamp...), when i parse the fig.data, i print the trace, the 'x': array changed into-->([208900...68400)].... do you know why? any suggestion please? I really need it as the datetime data type, this way I can pass this data into a subplot. thanks in advance!
@CharmingData
@CharmingData 3 жыл бұрын
Hi Ziyan, it's really hard to say without seeing the code. Can you please send me your code (or an excerpt of it if it's very long) with the data, so I can try to run on my computer and see what you see? You can send it here: adam@charming-data.com
@ziyancheng8903
@ziyancheng8903 3 жыл бұрын
@@CharmingData Much appreciated your reply, I am sending it now.
@1Revolucion1
@1Revolucion1 4 жыл бұрын
Hello, thanks for your videos, I have a problem, I don't know how to have two or more rows and columns, to have a more professional interface, I always have one graphic below the other, not like in your video that you see the pie graphic next to the table, will you help me please? thanks .. greetings from Colombia
@CharmingData
@CharmingData 4 жыл бұрын
Cómo estás David? Trata de ver este video sobre Dash Bootstrap. Es la mejor manera de lograr lo que tú buscas hacer. kzbin.info/www/bejne/rKK5qKOCacd6gbs
@geodancer7281
@geodancer7281 6 ай бұрын
Thank you for this tutorial and The Book of Dash. I think I am seeing the same problem @richardtarrillo1597 wrote about: On the right line plot, red is Germany and blue is Brazil. However, when I mouse over the two points on the left in the line plot (1952 and 1957) on either line, the left pie chart and its legend flip: red is Brazil and blue is Germany for both the legend and the information in the pie. I think I saw the same thing happen in your tutorial. I welcome your thoughts.
@CharmingData
@CharmingData 6 ай бұрын
hi @geodancer7281 Are you using the exact same code as in the video?
@geodancer7281
@geodancer7281 6 ай бұрын
@@CharmingData - Yes, same script. Look at your video 14 seconds in. As you wave your pointer around, watch the pie chart legend.
@CharmingData
@CharmingData 6 ай бұрын
@@geodancer7281 Now I see, thank you. One way to solve this is to hard code the colors per country with the color_discrete_map attribute of px.pie. You can do this inside the callback. colors = ['red','blue','green','orange', 'purple'] n_colors = colors[:len(country_chosen)] fig2 = px.pie(data_frame=dff2, values='pop', names='country', title=f'Population for: {hov_year}', color='country', color_discrete_map={country:color for color, country in zip(n_colors, country_chosen)} )
@geodancer7281
@geodancer7281 6 ай бұрын
@@CharmingData - Thank you for the code, but it seems to have created a different effect. I will work on this, let you know what I get.
@ayoubyoussoufi1623
@ayoubyoussoufi1623 4 жыл бұрын
Hello ! I am using dash with python 2.7 the line print(f'hover data: {hov_data}') is the formating with python 3. Can you tell me how should I print in python 2.7 "hov_data" ? I did this but it did not work : print('hover data: {hov_data}').format(hov_data)
@CharmingData
@CharmingData 4 жыл бұрын
Hi @Ayoub, I'm not sure how to do that in Python 2.7 but it shouldn't be very different than python 3 and I'm sure you would quickly find an answer on stackoverflow. I did print(f'hover data: {hov_data}') because I wanted to see a print-out of the hover data info. The hov_data is the argument inside the callack function def update_side_graph
@ayoubyoussoufi1623
@ayoubyoussoufi1623 4 жыл бұрын
@@CharmingData thank you. I found it ☺ I like the videos you made. It helps me to understand deeply dash. Thank you 😊
@lambdabld6658
@lambdabld6658 3 жыл бұрын
Please, it would be better if you explained what Div does actually and breakdown in more details, still didn't understand the whole thing
@CharmingData
@CharmingData 3 жыл бұрын
Ok. Good idea. I'll try to do that for the next video on layout
@suryabanerjee4071
@suryabanerjee4071 3 жыл бұрын
Hi. Thanks for the video, it's extremely informative and helpful. Can you help me with a persistent issue that I am currently facing? Whenever I am trying to import dash_core_components or dash_html_components or dash_bootstrap_components in jupyter , it's throwing an import error, stating cannot import _explicitize_args , has anyone faced this issue here? Please help. Can elaborate more if someone wants. Thanks in advance! P.s I am using dash 1.20.0 , which I believe is the latest. Version
@CharmingData
@CharmingData 3 жыл бұрын
Hi @Surya. I've never seen this error. Hopefully, other people in the community know this error and can help you out.
@felixkuria1250
@felixkuria1250 2 жыл бұрын
Hi .. this is a great video for a student of data analysis but am getting this error ⛑️ ID not found in layout 10:10:23 AM Attempting to connect a callback Output item to component: "my=graph" but no components with that id exist in the layout. If you are assigning callbacks to components that are generated by other callbacks (and therefore not in the initial layout), you can suppress this exception by setting `suppress_callback_exceptions=True`. This ID was used in the callback(s) for Output(s): my=graph.figure
@felixkuria1250
@felixkuria1250 2 жыл бұрын
Someone me to solve this
@CharmingData
@CharmingData 2 жыл бұрын
@@felixkuria1250 HI Felix, do you know how to use `suppress_callback_exceptions=True`?
@felixkuria1250
@felixkuria1250 2 жыл бұрын
@@CharmingData not really
@CharmingData
@CharmingData 2 жыл бұрын
@@felixkuria1250 try to do this: app = Dash(__name__, suppress_callback_exceptions=True)
@felixkuria1250
@felixkuria1250 2 жыл бұрын
@@CharmingData Thanks for this
Sharing Data between Dash Callbacks
20:19
Charming Data
Рет қаралды 21 М.
Plotly Tutorial - Basics in 7 Minutes!
6:56
Greg Hogg
Рет қаралды 25 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
Chained Callback in Dash
19:59
Charming Data
Рет қаралды 19 М.
Dash Cytoscape - Layout and User Interaction
18:54
Charming Data
Рет қаралды 6 М.
Introduction to Dash Plotly - Interactive Dashboards in Python
1:08:23
Code with Josh
Рет қаралды 4,2 М.
Fast Dash Apps for Production Environments
59:00
Plotly
Рет қаралды 8 М.
Deploy your Python Data App to the Web for Free - Dash
7:21
Plotly Express & Dash
42:38
Plotly
Рет қаралды 20 М.
The Dash Callback -  Input, Output, State, and more
26:55
Charming Data
Рет қаралды 62 М.
Software Testing Theory + A Few Less Obvious Testing Techniques
20:33