Jump to content

can we trust R in regard to drawing graphs?


Recommended Posts

Posted (edited)

I am trying to analyze graphs. 

but the interesting thing is that although I change the intervals sensitively, it gives me the same graph.

(embodiment: try to draw [math]  f(x)= x^{3} [/math] ,select first the interval [-2,2] and [-5,5] or symmetric else differently, see what happens.)

 

 

so, can we...?

Edited by ahmet
Posted (edited)

mmm, I am open to suggestions. 

😉

16 minutes ago, Bufofrog said:

What is R?

it is a program, deemed to be used or known(famuous)  by many statisticians.

Edited by ahmet
Posted

I kind of did what in hindsight I feel should have been provided by you in your starting post: Created the plots you spoke about and posted them here. The  code is

f = function(x) x*x*x

d3 = seq(-3, 3, 0.1)
d5 = seq(-5, 5, 0.1)
dx = seq(-3, 5, 0.1)

plot(d3, f(d3))
grid()

plot(d5, f(d5))
grid()

plot(dx, f(dx))
grid()

The created plots are attached. I see no problem with them. I am not aware of any technical problems that R has.

 

While not the question: I do not recommend to get used to R just because it has the reputation of being the most common software used in statistical data analysis. The statement may actually be true. And R is not bad, either. But I feel that Python can already compete with R in terms of (advanced) functionality, and will be the future. And for just plotting functions, there should be much easier solutions / more comfortable solutions (I had used gnuplot with lots of success for a long time).

da.png

d5.png

d2.png

Posted (edited)

thank you @timo for commenting. 

to begin with, I think I am not good in plotting. but simply need to see some or wide range of graph of functions. 

thus, if you believe that it would worth,then I will pass the programming level for learning it.

but for now, it seems a problem exists above, the range of y  (f) function (value set) does not seem with same ratio. Therefore, again the graphs you drawn are not realistic.

(meanwhile, I only used this commands)

curve(x^3, -5, 5)

curve(x^3, -3, 3) but same graphs.  (you of course shown the numbers corrrectly,  but those numbers are not with their real height)

maybe, I have lack of information about how to plot with  R,rather than criticizing it, but not sure. 

Edited by ahmet
Posted

Do I understand it correctly that the issue you see is the following: One unit in x-direction is a different amount of pixels (or cm on paper, if you'd print it out) than one unit in y-direction. Is that what you mean? That is indeed the case. I have never considered a problem. In my experience, this is the default behavior of most plotting engines. It is normal that in addition to looking at the shape of curves you also have to look at the numbers on the axes (small effects can often look large if you just zoom-in into the graph). And I do think there are more use-cases for having different spacings in x- and y-direction than for having the same spacing. In fact, it is very common that x- and y-values are not even comparable (e.g. one can be a time and one can be a number of people).

If you really want to have identical spacings, I think you can at least approximate that by setting the ranges by hand and forcing the aspect ratio or the size of the picture to fit to the ranges (same height and width of the x- and y-ranges are the same, double width if the x-range is double the y-range, etc). To set the range by hand, you can use

curve(x^3, -3, 3, ylim=c(-3,3)); grid()

Not sure how to set the window size by commands, but it should be possible. For an approximate solution, if you use R-Studio (which I really like for working with R) you can just resize the plot window to have the aspect ration you want and then export the image.

Posted (edited)
22 minutes ago, timo said:

Do I understand it correctly that the issue you see is the following: One unit in x-direction is a different amount of pixels (or cm on paper, if you'd print it out) than one unit in y-direction. Is that what you mean? That is indeed the case. I have never considered a problem.

yes correct. and this is an important problem to me. (and yes, both axes will/should be shown with the same units (e.g.: mm (x), mm( y) or cm( x) , cm(y))

I try to understand the characters of functions. 

but simply showing two graphs almost same one of them between -2,2 and the other one -100,100 is a problem in my work. 

what is more,presumably this Pogramming does not provide 3D plotting. 

to sum up this comment, I should nevertheless exceptionally  thank to you for providing information. 

 

Edited by ahmet
  • 2 weeks later...
Posted
On 9/27/2020 at 9:06 AM, Phi for All said:

I wouldn't trust R to draw a bucket up from a well. The best R can do is draw flies. Clearly R can't be trusted with graphs.

I didn't think Richard was that bad!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.