stacked-area-chart

How to fix Error in f(…) : Aesthetics can not vary with a ribbon

那年仲夏 提交于 2021-01-29 13:41:54
问题 I'm using ggplot2 to create a stacked area chart showing footprint (area) of a number of different research stations over time. I would like something that looks like the chart below, but with Area on the y axis and colored by the different research stations: (source: r-graph-gallery.com) I've tried elements of similar posts, but can't get it to work. Trouble with ggplot in R - "Error in f(...) : Aesthetics can not vary with a ribbon" Getting a stacked area plot in R https://www.r-graph

Grouped percent stacked bar plot using matplotlib

倖福魔咒の 提交于 2020-06-29 05:21:23
问题 I am trying to create a "grouped percent stacked bar plot" for want of a better name. Here is a simple working example of my code: import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import pandas as pd # Data r = [0,1,2,3,4] raw_data = {'PFHxA': [20, 1.5, 7, 10, 5], \ 'PFHpA': [5, 15, 5, 10, 15], \ 'PFOA': [2, 15, 18, 5, 10], \ 'PFNA': [2, 15, 18, 5, 10], \ 'PFDA': [2, 15, 18, 5, 10], \ 'PFUnDA': [2, 15, 18, 5, 10], \ 'PFHxS': [2, 15, 18, 5, 10], \ 'PFOS': [2, 15, 18

geom_area not stacking (ggplot)

北战南征 提交于 2020-02-24 12:56:00
问题 Here is the structure of my data: Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 60 obs. of 3 variables: $ year : num 1990 1990 1991 1992 1993 ... $ studyType: Factor w/ 4 levels "meta","observational",..: 2 3 3 1 3 3 3 1 3 3 ... $ N : int 1 4 4 1 2 5 3 1 2 6 ... I'm trying to get this into a stacked area chart using the following code: ggplot(evidence.summary.main, aes(x = year, y = N, fill=studyType)) + geom_area(alpha=.80) Any ideas why I cannot get this to stack properly? And my data from dput

geom_area not stacking (ggplot)

雨燕双飞 提交于 2020-02-24 12:55:52
问题 Here is the structure of my data: Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 60 obs. of 3 variables: $ year : num 1990 1990 1991 1992 1993 ... $ studyType: Factor w/ 4 levels "meta","observational",..: 2 3 3 1 3 3 3 1 3 3 ... $ N : int 1 4 4 1 2 5 3 1 2 6 ... I'm trying to get this into a stacked area chart using the following code: ggplot(evidence.summary.main, aes(x = year, y = N, fill=studyType)) + geom_area(alpha=.80) Any ideas why I cannot get this to stack properly? And my data from dput

introducing a gap in continuous x axis using ggplot

梦想的初衷 提交于 2020-01-05 04:32:08
问题 This is kinda a build-on on my previous post creating an stacked area/bar plot with missing values (all the script I run can be found there). In this post, however, Im asking if its possible to leave a gap in an continuous x axis? I have a time-serie (month-by-month) over a year, but for one sample one month is missing and I would like to show this month as a complete gap in the plot. Almost like plotting a graph for Jan-Aug (Sep is missing) and one for Oct-Dec and merging these with a gap

How to name sections on x axis that are separated by vertical lines in an R plot (package ggplot2)?

落爺英雄遲暮 提交于 2020-01-02 04:46:10
问题 I have created a stacked area plot with ggplot2 and added vertical lines at some positions on the x-axis . I now want to name the sections that are separated by these vertical lines. An example of it could look like it is shown on the example plot. Other solutions are also welcome. I have a vector of breaks (x-axis) and a vector of the names for the intervals. Code: library(ggplot2) d <- read.delim(...) x_breaks = c(-3999,1,599,4076,7557,11556) png(output, width=800, height=400) ggplot(d, aes

Create a 100 % stacked area chart with matplotlib

不问归期 提交于 2019-12-29 06:55:19
问题 I was wondering how to create a 100 % stacked area chart in matplotlib. At the matplotlib page I couldn't find an example for it. Somebody here can show me how to achieve that? 回答1: A simple way to achieve this is to make sure that for every x-value, the y-values sum to 100. I assume that you have the y-values organized in an array as in the example below, i.e. y = np.array([[17, 19, 5, 16, 22, 20, 9, 31, 39, 8], [46, 18, 37, 27, 29, 6, 5, 23, 22, 5], [15, 46, 33, 36, 11, 13, 39, 17, 49, 17]]

How to add negative values to JavaFx Area Chart?

混江龙づ霸主 提交于 2019-12-24 13:18:23
问题 I'd like to draw a difference (area) chart, something like this: How would d3.js difference chart example work with json data? where my chart is centered around horizontal (y=0) axis. JavaFx's Area chart seems to know how to fill only the area below the line!? Example "Adding negative value" (Fig 33-7) seems to be what I'm looking for (March series) BUT it does not work/render as shown! Instead of: it renders: Thanks, Igor 来源: https://stackoverflow.com/questions/30185035/how-to-add-negative

Group lowest values and sort this stacked area graph

纵然是瞬间 提交于 2019-12-24 12:51:49
问题 I have a time series of production in countries over time. I made this stacked area graph with the full data: The problem is that it isn't very readable (since using all countries means I can't have a legend) so I thought that I wanted to somehow group the lowest producing countries and sort the graph on the production from highest to lowest. I think that grouping and sorting based on the last years (2017) values would make the most sense, since the production is usually much higher. Here is