data-visualization

Avoid plot overlay using geom_point in ggplot2

六月ゝ 毕业季﹏ 提交于 2019-12-22 17:56:18
问题 In ggplot2, geom_point defaults to plotting over the current plot. For example, calling geom_point after a call to geom_boxplot results in the points plotted over the boxplot: ggplot(iris, aes(x = "All", y = Sepal.Length)) + geom_boxplot() + geom_point(aes(color=Species), position = "jitter") Is there a way to plot the points separately to the side, rather than over the boxplot? In my particular case I want to do this because the points obscure the plot (even with transparency, etc), a

texture in geom_polygon fill

我的梦境 提交于 2019-12-22 16:53:46
问题 I need to create a European map to show the distribution of a variable across countries. I need the map in black and white. I rely on ggplot and followed this approach as an example. I changed the legend based on this blogpost. All this works fine with this result: My question is how to change the map in a way that the countries where I am missing the information for fill and are shown as pure white have a texture over-them (I am thinking diagonal lines)? Since my script is a bit messy, I

texture in geom_polygon fill

余生颓废 提交于 2019-12-22 16:53:34
问题 I need to create a European map to show the distribution of a variable across countries. I need the map in black and white. I rely on ggplot and followed this approach as an example. I changed the legend based on this blogpost. All this works fine with this result: My question is how to change the map in a way that the countries where I am missing the information for fill and are shown as pure white have a texture over-them (I am thinking diagonal lines)? Since my script is a bit messy, I

texture in geom_polygon fill

时光毁灭记忆、已成空白 提交于 2019-12-22 16:53:02
问题 I need to create a European map to show the distribution of a variable across countries. I need the map in black and white. I rely on ggplot and followed this approach as an example. I changed the legend based on this blogpost. All this works fine with this result: My question is how to change the map in a way that the countries where I am missing the information for fill and are shown as pure white have a texture over-them (I am thinking diagonal lines)? Since my script is a bit messy, I

How to display data values in stacked horizontal bar chart in Matplotlib [duplicate]

ⅰ亾dé卋堺 提交于 2019-12-22 16:43:50
问题 This question already has answers here : Adding labels to stacked bar chart (2 answers) Closed 11 months ago . Hi I am currently plotting stacked horizontal bar chart using dataframe. The code is as below new_data.plot.barh(stacked = True) I get a chart like below. Ideally I would want to have the data values displayed inside it, like below. How do I accomplish this? Any help is appreciated. Thanks 回答1: there's a similar question here, just use ax.text and adjust the x and y positioning

add ticks to parcoord (parallel coordinates plot)

妖精的绣舞 提交于 2019-12-22 10:58:07
问题 The parcoord function from the MASS package looks quite ok, but how can I add ticks to the four y-axis? Code is here: ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3]) parcoord(log(ir)[, c(3, 4, 2, 1)], col = 1 + (0:149)%/%50) 回答1: Did you try setting var.label=T in the parcoord function? Is that insufficient? Otherwise i didn't see any easy way to change the axis with the default function. But it turns out that function is pretty short and we can easily steal ideas form it and make our own

Highcharts: is it possible to show all data labels in a bubble chart without them overlapping?

99封情书 提交于 2019-12-22 10:45:50
问题 I'm building a Highcharts bubble chart and am running into a challenge formatting the data labels. The data will be regularly updated, so there will be plenty of times when the bubbles either overlap or are very close to each other. By default, labels that are very close to one another will be omitted. However, my requirements for this chart include showing the data labels for all bubbles, regardless of their position (therefore, I'm setting allowOverlap to true ). Here is a variation of the

Plot spectroscopic data from pandas dataframe in 3D with different array length

删除回忆录丶 提交于 2019-12-22 06:48:56
问题 Is it possible to get something like this plot from a pandas dataframe, in a a similar fashion as I would just simply do to do 2d-plots ( df.plot() )? More precisely: I have data that I read from csv files into pandas DataFrames with following structure: 1st level header A B C D E F 2nd level header 2.0 1.0 0.2 0.4 0.6 0.8 Index 126.4348 -467048 -814795 301388 298430 -187654 -1903170 126.4310 -468329 -810060 304366 305343 -192035 -1881625 126.4272 -469209 -804697 305795 312472 -197013

Adding legend to a single line chart using ggplot

☆樱花仙子☆ 提交于 2019-12-22 06:39:35
问题 I just try to make a line chart and add a legend to it using ggplot in R. The following is my code. ggplot(mtcars, aes(x=mpg, y=wt)) + geom_line(stat = "identity") + scale_fill_identity(name = "", guide = "legend", labels = c("myLegend")) and I got the following: The legend is not shown in the plot and what I want is the following: which I plot using Matlab. Could anyone tell me how to do it in R? Thank you so much!! 回答1: You plot is not showing a legend, because there are no aesthetics

Trying to render data d3 crossfilter dc.js BarChart. The chart is drawn, but it's empty

只愿长相守 提交于 2019-12-22 01:30:00
问题 I must be doing something naive, but I can't get my data to render within the chart. here's my example data: var data = [ { date: '02-12-2013', val: 13, } { date: '02-13-2013', val: 6, } ... ] here's my code: var cf = crossfilter(data); var dim = cf.dimension(function(d){ return d.val }); var group = dim.group(); var barchart = dc.barChart('#container'); barchart.width(850) .height(250) .margins({top: 10, right: 50, bottom: 30, left: 40}) .dimension(dim) .group(group) .gap(1) .x(d3.time.scale