plotrix

Drawing circles in R

橙三吉。 提交于 2019-11-29 12:40:57
I'm using plotrix package to draw circles. And I don't get what is wrong with my code... :-( I have three points. The first point (1,1) should be the center of the circle. The following two points (1,4) and (4,1) have the same distance/radius to the center. So the circle in the plot should go through these points, right? And I don't know why the circle looks wrong. Is there an explanation? p1 <- c(1,1) p2 <- c(4,1) p3 <- c(1,4) r <- sqrt(sum((p1-p2)^2)) plot(x=c(p1[1], p2[1], p3[1]), y=c(p1[2], p2[2], p3[2]), ylim=c(-5,5), xlim=c(-5,5)) draw.circle(x=p1[1], y=p1[2], radius=(r)) abline(v=-5:5,

twoord plot in R

旧街凉风 提交于 2019-11-28 12:25:51
问题 Using the plotrix package to make a twoord plot. My attempts look like this The problem I have is that it automatically does not plot the full left axis? Why is this? It is the same in this example here How can I plot with 2 different y-axes? How is it possible to get the full left y? 回答1: As you didn't provide your data or your code, I offer this as an example: library(plotrix) twoord.plot(2:10, seq(3, 7, by=0.5) + rnorm(9), 1:15, rev(60:74) + rnorm(15), type= c("l", "l"), xaxt = 'n', yaxt =

ggplot2 polar plot arrows

你。 提交于 2019-11-27 22:32:20
I can use ggplot2 easily to draw a graph like below: In fact, for my data, it is like below: degree value 1 120 0.50 2 30 0.20 3 -120 0.20 4 60 0.50 5 150 0.40 6 -90 0.14 7 -60 0.50 8 0 0.60 The first column is the degree (from -180 to 180 or from 0 to 360), the second column is the corresponding values. So I want to draw a graph point from (0,0) to each my data point with arrow but with a circular coordinate as below: 2 http://www.matrixlab-examples.com/image-files/polar_plots_1.gif I try to use follow code: base <- ggplot(polar, aes(x=degree, y=value)) p <- base + coord_polar() p <- p + geom

Put a break in the Y-Axis of a histogram

℡╲_俬逩灬. 提交于 2019-11-27 01:37:53
I'm not sure exactly what to call this, but I'm trying to achieve a sort of "broken histogram" or "axis gap" effect: http://gnuplot-tricks.blogspot.com/2009/11/broken-histograms.html (example is in gnuplot) with R. It looks like I should be using the gap.plot() function from the plotrix package, but I've only seen examples of doing that with scatter and line plots. I've been able to add a break in the box around my plot and put a zigzag in there, but I can't figure out how to rescale my axes to zoom in on the part below the break. The whole point is to be able to show the top value for one

ggplot2 polar plot arrows

旧城冷巷雨未停 提交于 2019-11-26 21:01:36
问题 I can use ggplot2 easily to draw a graph like below: In fact, for my data, it is like below: degree value 1 120 0.50 2 30 0.20 3 -120 0.20 4 60 0.50 5 150 0.40 6 -90 0.14 7 -60 0.50 8 0 0.60 The first column is the degree (from -180 to 180 or from 0 to 360), the second column is the corresponding values. So I want to draw a graph point from (0,0) to each my data point with arrow but with a circular coordinate as below: (source: matrixlab-examples.com) I try to use follow code: base <- ggplot

Break X Axis in R

倖福魔咒の 提交于 2019-11-26 14:29:43
I want to get a broken X-axis in my plot. In the x-axis I like to insert a broken-axis symbol < // > [starting from 2 and ended in end 8 which means 2-8 will be hidden in < // > symbol] so the other values can be emphasized. In Matlab, this task is performed by using BreakXAxis . In R, plotrix library helps only to plugin a break-axis symbol, that's all. x <- c(9.45, 8.78, 0.93, 0.47, 0.24, 0.12) y <- c(10.72, 10.56, 10.35, 10.10, 9.13, 6.72) z <- c(7.578, 7.456, 6.956, 6.712, 4.832, 3.345) plot(x, y, col='blue', pch=16, xlab= 'x', ylab='y, z') points(x, z, col='red', pch=17) library(plotrix)

Break X Axis in R

99封情书 提交于 2019-11-26 04:44:59
问题 I want to get a broken X-axis in my plot. In the x-axis I like to insert a broken-axis symbol < // > [starting from 2 and ended in end 8 which means 2-8 will be hidden in < // > symbol] so the other values can be emphasized. In Matlab, this task is performed by using BreakXAxis. In R, plotrix library helps only to plugin a break-axis symbol, that\'s all. x <- c(9.45, 8.78, 0.93, 0.47, 0.24, 0.12) y <- c(10.72, 10.56, 10.35, 10.10, 9.13, 6.72) z <- c(7.578, 7.456, 6.956, 6.712, 4.832, 3.345)