subplot

Click-event not triggering inside a Plotly subplot within Shiny

允我心安 提交于 2021-02-08 06:47:50
问题 I'm creating a shiny app with 2 different tabs. Each of them has a couple of plotly plots. I want the plots to only react to the plotly_click events from the correspondent tab. My problem comes when instead of having separated plots, I want one of them to be part of a subplot. To do so, I have added the source parameter to the plots in order to distinguish which plot is the one that has been clicked. When the plots are individual plots (not inside a subplot) works nicely, but if I try to put

Click-event not triggering inside a Plotly subplot within Shiny

混江龙づ霸主 提交于 2021-02-08 06:47:48
问题 I'm creating a shiny app with 2 different tabs. Each of them has a couple of plotly plots. I want the plots to only react to the plotly_click events from the correspondent tab. My problem comes when instead of having separated plots, I want one of them to be part of a subplot. To do so, I have added the source parameter to the plots in order to distinguish which plot is the one that has been clicked. When the plots are individual plots (not inside a subplot) works nicely, but if I try to put

How can I modify my subplot positions to stop them overwriting each other?

a 夏天 提交于 2021-02-05 09:24:06
问题 I am trying to create a subplot (6 plots) of world maps into which I am writing chosen shapefiles. My issue is with my placement of subplots: They are overwriting each other. I understand from the other questions like this on stackoverflow, that it is because the axes are overlapping somehow. But I thought I had created positions that they would just be 'side-by-side' (see code below). I have tried to make the axes transparent and that doesn't seem to help. My question is: how can I modify

Plotting with multiple y values with subplot and groupby

扶醉桌前 提交于 2021-01-29 17:28:44
问题 I have a df . See below for the head: Country Date suspected case confirmed cases suspected deaths confirmed deaths 0 Guinea 2014-08-29 25.0 141.0 482.0 648.0 1 Nigeria 2014-08-29 3.0 1.0 15.0 19.0 2 Liberia 2014-08-29 382.0 674.0 322.0 1378.0 By using df.groupby('Country') I want to plot the suspected case against the confirmed case using the Date column for the xaxis . Plotting these as (5, 2) subplots What I've done so far hasn't quite got it yet: fig, ax = plt.subplots(2, 5, sharey=True)

Not able to create a 3x3 grid of subplots to visualize 9 Series individually

本小妞迷上赌 提交于 2021-01-29 16:25:27
问题 I want to have a 3x3 grid of subplots to visualize each Series individually. I first created some toy data: import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set(style='whitegrid', rc={"figure.figsize":(14,6)}) rs = np.random.RandomState(444) dates = pd.date_range(start="2009-01-01", end='2019-12-31', freq='1D') values = rs.randn(4017,12).cumsum(axis=0) data = pd.DataFrame(values, dates, columns =['a','b','c','d','e','f','h','i','j','k','l','m'])

Nesting or combining matplotlib figures and plots?

天大地大妈咪最大 提交于 2021-01-29 16:11:29
问题 I have a function that takes an arbitrary length 3D data set of dates, prices(float), and some resulting value(float) and makes a set of seaborn heatmaps split by year. The pseudocode is as follows (note the number of years varies by dataset so I need it to arbitrarily scale): def makePlots(data): split data by year fig,axs=plt.subplots(1, numYears) x=0 for year in years sns.heatmap(data[year], ax = axs[x++]) return axs this outputs a single matplotlib figure with a heatmap for each year next

Matplotlib add gridlines not working as expected

二次信任 提交于 2021-01-29 15:41:53
问题 Using matplotlib subplots() in Jupyter Notebook, and using "seaborn-whitegrid" plot.style() . I am trying to add minor gridlines to my x-axis, which is in log. What am I missing? import matplotlib.pyplot as plt %matplotlib inline plt.style.use('seaborn-whitegrid') x, y = [(1, 9, 65, 142, 330), (0, 0.16, 0.50, 0.84, 1)] fig, axes = plt.subplots(3,5, figsize=(8.5,5.5), constrained_layout=True) #counter = 0 for ax in axes.flat: ax.plot(x,y) ax.set_title('Dataset-A', fontsize=8) ax.set_xlabel('x'

Adding a figure created in a function to another figure's subplot

做~自己de王妃 提交于 2021-01-29 08:27:29
问题 I created two functions that make two specific plots and returns me the respective figures: import matplotlib.pyplot as plt x = range(1,100) y = range(1,100) def my_plot_1(x,y): fig = plt.plot(x,y) return fig def my_plot_2(x,y): fig = plt.plot(x,y) return fig Now, outside of my functions, I want to create a figure with two subplots and add my function figures to it. Something like this: my_fig_1 = my_plot_1(x,y) my_fig_2 = my_plot_2(x,y) fig, fig_axes = plt.subplots(ncols=2, nrows=1) fig_axes

Adding two smaller subplots to the side of my main plot in matplotlib subplots

帅比萌擦擦* 提交于 2021-01-29 06:44:35
问题 Currently my chart is showing only the main big chart on the left. However, I now want to add the two smaller plots to the right-hand side of my main plot; with each individual set of data. I am struggling with subplots to figure out how to do this. My photo below shows my desired output. filenamesK = glob("C:/Users/Ke*.csv") filenamesZ = glob("C:/Users/Ze*.csv") K_Z_Averages = {'K':[], 'Z':[]} # We will create a function for plotting, instead of nesting lots of if statements within a long

Resize subplots using seaborn

依然范特西╮ 提交于 2021-01-29 03:14:51
问题 I have just recently started to use matplotlib and seaborn to plot my graphs. This is the code that I wrote so far count = 1 l=[13,0,47,29,10] plt.figure(figsize=(30,40)) for ww in l: temp_dict = defaultdict(list) entropies = list() for k,v in df.ix[ww].iteritems(): e = 0 for i in v: temp_dict[k].append(float(i)) if not float(i) == 0: e += -1.0*float(i)*log10(float(i)) entropies.append(e) y = entropies x=(range(len(entropies))) slope, intercept, r_value, p_value, std_err = stats.linregress(x