plot

How to separate two plots in R ?

Whenever I run this code , the first plot would simply overwrite the previous one. Isnt there a way in R to separate to get two plots ? plot(pc) title(main='abc',xlab='xx',ylab='yy') plot(pcs) title(main='sdf',xlab='sdf',ylab='xcv') ...

How do I display an arrow positioned at a specific angle in MATLAB?

I am working in MATLAB and I'm stuck on a very simple problem: I've got an object defined by its position (x,y) and theta (an angle, in degrees). I would like to plot the point and add an arrow, starting from the point and pointing toward the direction defined by the angle. It actually doesn't even have to be an arrow, anything graphical...

How to plot a 3D plot in MATLAB?

I have three parameters x,y and t. But the problem is my file structure. My files are named as: e_x_y.txt t_x_y.txt where e_x_y.txt has the error for particular values of x and y and t_x_y.txt has corresponding time values. I need to plot the values in e_x_y.txt on a x vs y vs t graph. What is the best way to do that? I know what ...

Generating names iteratively in R for storing plots

I'm using R to loop through a data frame, perform a calculation and to make a plot. for(i in 2 : 15){ # get data dataframe[,i] # do analysis # make plot a <- plot() } Is there a way that I can make the plot object name 'a', using the value of 'i'? For example, a + "i" <- plot(). Then I want to add that to a vector so I have a seri...

rotating axis labels in R

In R, how do I make a (bar)plot's y axis labels parallel to the X axis instead of parallel to the Y axis? ...

Suitable marker distance along axis in plotter

I'm writing a 2D plotter, and along the X- and Y-axis I have markers with printed values. Now my question is: how do I find suitable distances? My method (for a numeric axis) is so far: I know the height of the axis on screen in pixels Decide an optimal distance between markers in pixels (what looks good on screen ...), for example 32...

How do I save a plotted image and maintain the original image size in MATLAB?

I'd like to show an image and plot something on it and then save it as an image with the same size as the original one. My MATLAB code is: figH = figure('visible','off'); imshow(I); hold on; % plot something saveas(figH,'1','jpg'); close(figH); But the resulting image "1.jpg" has saved non-image areas in the plot as well as the image....

Save Matlab invisible plot under terminal as an image with same size

Hi, I am ssh connecting to a linux server and do some Matlab programming. I would like to save invisible plot as figH = figure('visible','off') ; % Plot something % save the plot as an image with same size as the plot close(figH) ; saveas() and print() will change the size of the saved image different than the size of plot. Als...

Plotting functions in R

Is there a way of overlaying a mathematical function on top of data using ggplot? ## add ggplot2 library(ggplot2) # function eq = function(x){x*x} # Data x = (1:50) y = eq(x) # Make plot object p = qplot( x, y, xlab = "X-axis", ylab =...

How can I draw a circle on an image in MATLAB?

I have an image in MATLAB: im = rgb2gray(imread('some_image.jpg'); % normalize the image to be between 0 and 1 im = im/max(max(im)); And I've done some processing that resulted in a number of points that I want to highlight: points = some_processing(im); Where points is a matrix the same size as im with ones in the interesting poin...

Why does a circle plotted in MATLAB appear as an ellipse?

I wonder in MATLAB how I would plot a circle and show it correctly instead of by default showing it as an ellipse. I guess it has something to do with the local coordinate system in the axis. ...

Plot multiple sets of points in R

I have multiple sets of xy pairs that I want to plot. I want each set of xy pairs to be connected by a line. In other words the goal is to have multiple experimental instances each approximated by a line plotted on one plot. Also how would I colour the lines differently? The plot function does what I want, but takes on one set of xy ...

Plotting cartesian plots, axis inside the figure, possible annotations

Is there any software or library able to plot cartesian plots "high school style" with the axis as a cross inside the figure? Most plotting software I tried just puts the axis as a box around the plot, maybe useful for real world data but for studying simple functions it has less visual information. In addition if it's able to put anno...

Plot graphs in MATLAB

I have a txt file with the following values on each line: SRNO Value1 Value2 There are around 2000 such lines. I would like to plot both Value1 and Value2 in MATLAB Any code on how I could do it? Thanks ...

Combining 3D/2D plots

I'm trying to make a visualization that looks like this . The idea is to have a 3D surface plot overlapping a 2d representation of a surface. I can build arbitrary surfaces/polygon shapes (as in http://addictedtor.free.fr/graphiques/graphcode.php?graph=135 ) and I can make the respective 2D plot. What I don't seem to be able to figure ...

How to format axes in R, year and months

I have the following dataset 1890 mar 0.4 1890 apr 0.8 1890 may 1.0 ... 1989 jan 0.2 1989 feb 0.4 1989 mar 0.5 How can I make a line plot in R with on the x-axis the year, displayed every 5 years? My problem is not so much making the plot, but getting to display only the years I want, and place them on the beginning of that year. So ...

How to create a sensible Hilbert Spectrum plot with R (computing environment)

I am using the EMD package for R. This package has a spectrogram function for displaying a Hilbert Spectrum (calculated with hilbertspec). The output however, is really vague and black-white. This function does not seem to have an option for outputting color images. How can I get the spectrum displayed clearly and if possible in color. ...

Plotting a 3d surface plot with contour map overlay, using R

I have a 3-tuple data set (X,Y,Z points) that I want to plot using R. As the title of my question states, I want to create a surface plot from the data, and superimpose a contour map on the surface plot, so as to create the impression of the contour map being the "shadow" or projection from the surface plot. The contour map is to appear...

Highlighting specific values in R plot

In R (statistical computing environment) I would like on a generic plot, with time on the x-axis, highlight some specific years. How can I bestly do this? My idea is for example a light yellow bar for the highlighted years, behind the plot of course. The plot code I have now: pdf("temperature_imfs_big_interm5.pdf", width=6, height=8);...

Turn Matlab plot into image

Hi, I have generated a plot like figure; hold; axis([0 10 0 10]); fill([ 1 1 5 5], [5 1 1 5],'b') and now I want to have this plot as an matrix so that I can i.e. filter the blog with a gaussian. Googleing I found this thread Rasterizing Plot to Image at Matlab Central. I tried it, but I could only get it to work for line or function...