1

I have a function psi such that the R code: x^{4/3})*(sin((4*y)/3). I want to plot this function for different values i.e.

x^{4/3})*(sin((4*y)/3)=0,
x^{4/3})*(sin((4*y)/3)=1, 
x^{4/3})*(sin((4*y)/3)=2 

etc... onto the same graph.

One of the plots should look like this: psi = 2

How can I do this in R?

ThomasIsCoding
  • 96,636
  • 9
  • 24
  • 81
  • 1
    Polar plots do exist in R, both in base graphics and `ggplot2`. Even without the native format, one should be able to use basic geometry to convert from cartesian to polar. What have you tried so far? – r2evans Aug 15 '21 at 21:56
  • I have tried but none have worked, Desmos gives a good result but it doesn't allow values of r to the power of anything – Diesel Blue Aug 15 '21 at 22:17
  • What have you tried *in R*? See e.g. https://ggplot2.tidyverse.org/reference/coord_polar.html ; https://ggplot2.tidyverse.org/reference/geom_function.html ; https://stackoverflow.com/questions/8082429/plot-a-heart-in-r/8082633#8082633 – Ben Bolker Aug 15 '21 at 22:22
  • I haven't seen any examples of someone using two variable functions i.e. ```function(x,y)(x^{4/3}*sin(4*y/3))``` , they're all single variable functions – Diesel Blue Aug 15 '21 at 22:55
  • 1
    This is called a *parametric plot*: see https://stackoverflow.com/questions/22996220/plot-a-continuous-function-in-r/22996608#22996608 – Ben Bolker Aug 15 '21 at 23:52
  • Can't you solve this for x in terms of y, e.g. `x=(c/*(sin((4*y)/3)^(3/4)` where `c` is the relevant contour? – Ben Bolker Aug 16 '21 at 00:15

0 Answers0