How can I read coordinate values from the plot graph? - r

I have drawn a plot graph enter image description here
I want to read the coordinate values of the intersection dot in the following graph.enter image description here
Are there any packages or functions to do this?
Thanks for your answer.

Related

Plotting three-dimensional vector field as coherent structures using Matlab

I have a three-dimensional vectorfield containing of coherent structures in the form of counter-rotating circles.
I would like to show these structures three-dimensionally.
So far I have used contour() in order to plot the strucutres on the y,z plane as shown in the figure below, where circles of constant magnitude are plotted.
Now I would like to plot these circles three-dimensionally, this would result in the circles being tilted in the direction of the viewer as one can see from the next plot.
How would I be able to plot such three-dimensional strucutres, where the circles are tilted in the direction of the viewer?
Functions as isosurface() do not seem to help.
I would very much appreciate any kind of help.
I have tried various functions such as isosurface(), quiver3() and streamtube() however I am not able to show the plot I am interested in: a single slice of circles being tilted in the direction of the viewer shown in a three-dimensional plot.

Create interactive plot in R

I wonder if it is possible in R (RStudio) to have an interactive plot where user clicks in an image and this is used as input for upcoming processing. Here is my situation:
I have a raster that I plot
plot(NDVI[[4]])
[![enter image description here][1]][1]
Afterwards, I add a second layer containing polygon limits:
plot(fields, add=TRUE)
[![enter image description here][2]][2]
My objective is that user clicks on the image to select some of these polygons (let's say 3). Those clicks are used to identify those polygons which will later be used to derive the mean raster value inside the area they represent.
So far, I have been doing so updating a shapefile containing points, but I would like to make more interactive
points<-readOGR("Points_crops.shp")
fields<-readOGR("Boundaries.shp")
fields_sub <- fields[!is.na(sp::over(fields, sp::geometry(points))), ]
NDVI_mean<-lapply(NDVI, FUN=function (NDVI) {data.frame(mean=extract(NDVI,fields_sub,fun=mean))})
For those interested, I have solved the issue using the click function. This will retrieve the coordinates of the point you click with the mouse. After that, you can convert them to spatialPoints setting a proj4string (same as the one of the raster of reference).
points<-click(NDVI[[4]], n=5, xy=TRUE, show=TRUE)
points$value<-NULL
points<-SpatialPoints(points, proj4string = crs(S2_stack_crop[[2]]))
Once I have the points as spatialPoints I can continue with the next step

How to produce a scatterplot in Julia-lang with labelled points?

Using Julia-lang, how can a scatterplot of two vectors be plotted with pyplots (or GR) to label each point with a specific string? Eg. each paired (x,y) takes on the index value they both share? Example from MATLAB: image example
Do you mean with GR or PyPlot themselves, or through Plots.jl? I know Plots.jl best - with that you'd do scatter(x,y, series_annotations = text.(1:length(x), :bottom)) .
Unfortunately it currently plots very close to the points - :bottom means that the bottom of the text touches the point.

R non gridded filled contour

I have a set of data that I'm trying to create a surface plot of. I have an x,y point and a to colour by.
I can create a xy plot with the points coloured but I can't find a way to create a surface plot with my data. The data isn't on a normal grid and I would prefer to not normalize it if possible (or I could just use a very fine grid).
The data won't be outside the a radius=1 circle so this part would need to be blank.
The code and the plot is shown below.
I've tried using contour, filled.contour as well as surface3d (not what I wanted). I'm not real familiar with many packages in R so I'm not even sure where to begin looking for this info.
Any help in creating this plot would be appreciated.
thanks,
Gordon
dip<-data.frame(dip=seq(0,90,10))
ddr<-data.frame(ddr=seq(0,350,10))
a<-merge(dip,ddr)
a$colour<-hsv(h=runif(nrow(a)))
degrees.to.radians<-function(degrees){
radians=degrees*pi/180
radians
}
a$equal_angle_x<-sin(degrees.to.radians(a$ddr))*tan(degrees.to.radians((90-a$dip)/2))
a$equal_angle_y<-cos(degrees.to.radians(a$ddr))*tan(degrees.to.radians((90-a$dip)/2))
plot(a$equal_angle_x,a$equal_angle_y,col=a$colour,lwd=10)
With regards to the plot I was trying to create is below. I believe the link in the first comment should get me where I'm trying to go.

Defining polygon coordinates with a predefined image and plotting in R

Here is what I need: I have an image and want to plot on specific rectangle-shaped parts of it (e.g., imagine having a picture of a chessboard and wanting to fill every square with a different color). I would like to be able to easily specify the coordinates for these parts and take these coordinates into R for plotting.
I don't have any experience with making such plots. I've thought of simply inserting an image into a plot with rasterImage (), then plotting with polygon (), but the task of setting up the coordinates for the polygon function seemed too time consuming - hence the question above.
If you have any better ideas than using a set of coordinates for the polygon function, please share. Any leads or packages suggestions would also be helpful.
thank you. Marko.

Resources