plotly

Plotly: treemap element with “href” not working

雨燕双飞 提交于 2020-08-03 10:34:41
问题 I have simple table whin href link inside the text. But clicking on it doesn't open the page. is there any easy way to do that? import plotly.express as px df = px.data.gapminder().query("year == 2007") link_ref = '<a xlink:href="http://google.com" style="cursor: pointer" target="_blank" rel="noopener noreferrer">{}</a>' df['country'] = df['country'].apply(lambda item: link_ref.format(item, "{}")) fig = px.treemap(df, path=[ 'continent', 'country'], values='pop', color='lifeExp', hover_data=[

List of locationmode to use with plotly

我怕爱的太早我们不能终老 提交于 2020-08-03 03:59:20
问题 I need to make a graphical representation of data distributed in Brazil, which is my country. I found that plotly can do this job, but when I went to research how to use plotly, every tutorial was using the locationmode attribute as 'USA-states'. Is there a list with countries codes, so I can go after to see which is the right way of calling it? 回答1: From docs: https://plot.ly/python/reference/#scattergeo-locationmode locationmode ( enumerated : "ISO-3" | "USA-states" | "country names" )

List of locationmode to use with plotly

爱⌒轻易说出口 提交于 2020-08-03 03:59:09
问题 I need to make a graphical representation of data distributed in Brazil, which is my country. I found that plotly can do this job, but when I went to research how to use plotly, every tutorial was using the locationmode attribute as 'USA-states'. Is there a list with countries codes, so I can go after to see which is the right way of calling it? 回答1: From docs: https://plot.ly/python/reference/#scattergeo-locationmode locationmode ( enumerated : "ISO-3" | "USA-states" | "country names" )

Plotly Chart at Tkinter Python

冷暖自知 提交于 2020-08-02 06:41:54
问题 is it possible to show Plotly chart at Tkinter GUI? I have been trying to make this happens but to no avail. Here is the code I have (the Plotly code is copied from the Plotly website): from tkinter import * import plotly.plotly as py import plotly.graph_objs as go from datetime import datetime import pandas.io.data as web mGui = Tk() mGui.geometry('651x700+51+51') mGui.title('Plotly at Tkinter') df = web.DataReader("AAPL", 'yahoo', datetime(2007, 10, 1), datetime(2016, 7, 11)) trace = go

How to change data and graph using buttons in plotly python?

心已入冬 提交于 2020-08-02 04:20:01
问题 Based on this code directly from plotly's tut page: https://plot.ly/python/dropdowns/ Now, what if I want to change not just the chart type but rather the data source and its chart type? Is it possible? EDIT: I've played with this settings: data1 = go.Surface(z=df.values.tolist(), colorscale='Viridis') data2 = go.Heatmap(z=df.values.tolist()) buttons=list([ dict( args=[data1], label='3D Surface', method='restyle' ), dict( args=[data2], label='Heatmap', method='restyle' ) ]) However, the

How to change data and graph using buttons in plotly python?

青春壹個敷衍的年華 提交于 2020-08-02 04:19:08
问题 Based on this code directly from plotly's tut page: https://plot.ly/python/dropdowns/ Now, what if I want to change not just the chart type but rather the data source and its chart type? Is it possible? EDIT: I've played with this settings: data1 = go.Surface(z=df.values.tolist(), colorscale='Viridis') data2 = go.Heatmap(z=df.values.tolist()) buttons=list([ dict( args=[data1], label='3D Surface', method='restyle' ), dict( args=[data2], label='Heatmap', method='restyle' ) ]) However, the

How to change data and graph using buttons in plotly python?

寵の児 提交于 2020-08-02 04:19:07
问题 Based on this code directly from plotly's tut page: https://plot.ly/python/dropdowns/ Now, what if I want to change not just the chart type but rather the data source and its chart type? Is it possible? EDIT: I've played with this settings: data1 = go.Surface(z=df.values.tolist(), colorscale='Viridis') data2 = go.Heatmap(z=df.values.tolist()) buttons=list([ dict( args=[data1], label='3D Surface', method='restyle' ), dict( args=[data2], label='Heatmap', method='restyle' ) ]) However, the

Is there any way to draw INDIA Map in plotly?

戏子无情 提交于 2020-08-01 06:29:22
问题 I am trying to plot India map using plotly, but unable to find a way to do that. Below is the code which I tried for USA. import pandas as pd df_sample = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/laucnty16.csv') df_sample['State FIPS Code'] = df_sample['State FIPS Code'].apply(lambda x: str(x).zfill(2)) df_sample['County FIPS Code'] = df_sample['County FIPS Code'].apply(lambda x: str(x).zfill(3)) df_sample['FIPS'] = df_sample['State FIPS Code'] + df_sample['County

Fix plotly ggplotly() Title Overlapping Plot When Title is Split on Two Lines

你离开我真会死。 提交于 2020-07-31 05:11:48
问题 In the example below, the second line of the title overlaps slightly with the plot. Is there a way to fix this by increasing the spacing between the title and plot? library(ggplot2) library(plotly) library(magrittr) p1 <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) + geom_point() + ggtitle("A REALLY, REALLY, REALLY LONG TITLE THAT I WANT TO\nSPLIT INTO TWO LINES") p1 ggplotly() %>% config(collaborate=FALSE, cloud=FALSE, displaylogo=FALSE, modeBarButtonsToRemove=c("select2d",

Succint way to add line segments to plotly graph (with python/jupyter notebook)?

跟風遠走 提交于 2020-07-30 01:55:45
问题 I want to create a lollipop plot with several horizontal line segments like this - https://python-graph-gallery.com/184-lollipop-plot-with-2-group. I'd like to use plotly since I prefer the graphics (and easy interactivity) but can't find a succint way. There's both line graphs (https://plot.ly/python/line-charts/) and you can add lines in the layout (https://plot.ly/python/shapes/#vertical-and-horizontal-lines-positioned-relative-to-the-axes), but both of these solutions require each line