plot

R plot- SGAM plot counts vs. time - how do I get dates on the x-axis?

I'd like to plot this vs. time, with the actual dates (years actually, 1997,1998...2010). The dates are in a raw format, ala SAS, days since 1960 (hence as.date conversion). If I convert the dates using as.date to variable x, and do the GAM plot, I get an error. It works fine with the raw day numbers. But I want the plot to display t...

Matlab- select data from a 3d plot

Hey, I have a 3d plot. I want to select a certain area in the plot and get the points within this area into a variable. Is that possible? Thanks, Li ...

"Invalid Handle Object" when plotting 2 figures Matlab

I'm having a difficult time understanding the paradigm of Matlab classes vs compared to c++. I wrote code the other day, and I thought it should work. It did not... until I added <handle after the classdef. So I have two classes, landmarks and robot, both are called from within the simulation class. This is the main loop of obj....

R is plotting labels off the page.

Hi. i'm running the following: png(filename="figure.png", width=900, bg="white") barplot(c(1.1, 0.8, 0.7), horiz=TRUE, border="blue", axes=FALSE, col="darkblue") axis(2, at=1:3, lab=c("elephant", "hippo", "snorkel"), las=1, cex.axis=1.3) dev.off() and the labels on the left are appearing off the page. I can't seem to figure out how t...

Plotting a grouped 2 dimensional vector in MATLAB

I am trying to make a plot of a 2-dimensional vector (2D Plot). But I don't want all the datapoints to have the same color on the plot. Each datapoint corresponds to a group. I want to have different colors for each group of datapoints. class=[1 3 2 5 2 5 1 3 3 4 2 2 2] says each datapoint belongs to which group X=[x1,y1;x2,y2;x3,y...

Drawing a polygon around groups of datapoints in MATLAB

I have a set of datapoints each of which belongs to a certain cluster (group). I need to draw a polygon around each of these clusters. Does anyone knows how to do it? It doesn't matter if I use or not use the actual datapoints for drawing the polygon. I just need them to be wrapped in a polygon. ...

What's the best way to annotate this ggplot2 plot? [R]

Here's a plot: library(ggplot2) ggplot(mtcars, aes(x = factor(cyl), y = hp, group = factor(am), color = factor(am))) + stat_smooth(fun.data = "mean_cl_boot", geom = "pointrange") + stat_smooth(fun.data = "mean_cl_boot", geom = "line") + geom_hline(yintercept = 130, color = "red") + annotate("text", label = "130 hp", x = ...

Why doesn't JFreeCharts correctly connect the points in my xy-line graph?

Each letter A,T,G,C represents a direction for the plot to graph. Specifically, “A” means move right, “T” is move down, “C” is move up, and “G” is move left. When the applet reads A,T,C, it plots the graph correctly. However, when I plot G, the graph is messed up. When I input "ACACACA," the graph is like a rising staircase. When I input...

How to draw scruffy diagrams in R?

Any ideas how to do "scruffy" bar and scatter plots (like yuml) in R? ...

How do I make a surf plot in MATLAB with irregularly spaced data?

I know I can create a 3D surface plot in MATLAB by doing: x = linspace(1,10,100); y = linspace(10,20,100); [X Y] = meshgrid(x,y); Z = X * Y; surf(X,Y,Z); But this requires that all the nodes for the height map generated line up. I have a set of data which has arbitrary points (x,y) and a height (z). Is there a simple way to plot a ...

How do I edit the axes of an image in MATLAB to reverse the direction?

I would like to edit the axes in my series of images being displayed. This is what my image looks like: As you can see, it ranges from 0 to about 500 from top to bottom. Can I invert that? Plus, I want to mirror the image being shown, so that it starts from left to right... or, if it's possible, to let the axes show from right to lef...

Plot overlaps in matlab

I have a strange problem that the plot overlaps in the graph, but not in the image in the same axis. I am sure I didn't leave hold on somewhere or else it will overlap in the image itself as well. EDIT : I want to get rid of the blue overlapped lines, I only want one blue line to be present in that pic. Here is a sample : (NOTE : The...

MATLAB and gplot

I'm trying to find a way to plot a truss in MATLAB, I can do it by using an adjacency matrix and the gplot function, but its very long winded approach especially if there are a lot of nodes connected to one another. Is there a faster way to do this? ...

pgf/tikz: String Symbols as Input Coordinates

Hi all, I'm new to pgf so i was trying out some examples from the pgfplot manual. One example is especially relevant for my current task but, alas, it would not compile. Here is the code: \documentclass[11pt]{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[symbolic x coords={a,...

Writing a custom wpf 'rolling' plot control (are there any components with such functionality?)

I need a wpf plot control that would 'roll' (scroll) as data is fed to it (instead of stretching, etc). Unfortunately i didnt find a working component so now I am considering writing my own control (its plotting features need to be simple). Did anyone write a custom plot/chart control? Is it difficult? What container should I use (Canva...

How to code a time delay between plotting points in JFreeCharts?

Is there a way to animate the plotting process of an xy-line chart using JFreeCharts? I want to be able to watch the program draw each line segment and connect them. For example, if I paste this into the TextArea, "gtgtaaacaatatatggcg," I want to watch it graph each line segment one by one. Thanks in advance! :) My code is below: i...

Can IDL create a contour plot colorbar like this?

At the bottom of this image, you'll see a nice colorbar that matches the colors of the graph correctly: http://stribog.cc.umanitoba.ca/ceos/20100517_00z_prod/ I couldn't find anything that created a color bar with exactly the colors I wanted, it always seemed to involve a spectrum that included colors I didn't use. I have a vector of ...

Matlab Error- fplot();

>> fplot(fh,[-2 4]) ??? Undefined function or variable "e". Error in ==> myfun at 3 Y(:,2) = e(:).^x; Error in ==> fplot at 102 x = xmin; y = feval(fun,x,args{4:end}); I tried to plot two function using this m file. function Y = myfun(x) Y(:,1) = 3*x; Y(:,2) = e(:).^x; ...

Strange Matlab error: "??? Subscript indices must either be real positive integers or logicals"

I have a function func that returns a vector a. I usually plot a and then perform further analysis on it. I have a certain scenario when once I try to plot a, I get a "??? Subscript indices must either be real positive integers or logicals" error. Take a look at the following piece of code to see the vector's behavior: K>> a a = 5....

Drawing and filling different polygons at the same time in MATLAB

Hi,I have the code below. It load a CSV file into memory. This file contains the coordinates for different polygons.Each row of this file has X,Y coordinates and a string which tells that to which polygon this datapoint belongs. for example a polygone named "Poly1" with 100 data points has 100 rows in this file like : Poly1,X1,Y1 Poly...