How to add a single new contour to a contour plot in Lattice 
Load the latticeExtra library. Then:
Part1<contourplot(
Male ~ Year * Age,
data=this.ds,
region=T, col.regions=rev(heat.colors(200)),
cuts=50, main="", sep="")
Part2<contourplot(
Male ~ Year * Age,
data=this.ds, region=F, labels=F, lwd=2, at=c(0, 0.01, 1))
Plot.Final<Part1+Part2
That should combine the graphs as you wish. If needed you may need to set
xlim, ylim and labels so that everything looks OK.

Matplotlib: Scatter Plot to Foreground on top of a Contour Plot 
You can manually choose in which order the different plots are to be
displayed with the zorder parameter of e.g. the scatter method.
To demonstrate, see the code below, where the scatter plot in the left
subplot has zorder=1 and in the right subplot it has zorder=1. The object
with the highest zorder is placed on top. This means that the scatter will
be placed on top of the contour in the first subplot, while it is placed
underneath in the second subplot.
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
delta = 0.025
x = np.arange(3.0, 3.0, delta)
y = np.arange(2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10.0 * (Z2  Z1)

Using contour to plot function 
Are x and y properly defined as 2x2 matrices? If so then the "power"
operator needs to be done on a componentwise basis (.^3 instead of ^3).
This works:
[x,y] = meshgrid(2:.2:2,2:.2:2);
contour(3*y+y.^3x.^35)

Need Help in Contour Plot in Matlab 
There are a few things to note:
1.) As Jacob Robbins pointed out correctly in his comment, you should avoid
using names from Matlab functions as variable names (in your case min and
max). One very easy way to do this, is to use only upper case letters for
variable names.
2.) You are correct in saying that your fis only one output (though one
output in this case is not a single number, but a vector). That is, because
you don't assign any indexing to it within the loop.
3.) Yes, both contour and surfc need at least 2x2  because they plot
information on a grid, which is itself at least 2x2 in nature.
4.) In your particular case, two loops may not be necessary. You seem to
only be manipulating the xvector and your grid is regular. Hence you might
want to try this loop:
for I=1:le

Long error in contour plot python 
The error states that
TypeError: Input z must be a 2D array.
if you look at the sizes of the input objects:
print EF.shape, EB.shape, a.shape
(51,) (51,) (51,)
you'll see that these are not 2D arrays. Did you intend to use X and Y
instead?
When I make the change to
a =
((1+.5*(np.exp(1.7*X)+np.exp(1.7*Y)+np.exp(1.7*(X+Y))))/(1+np.exp(1.7*X)+np.exp(1.7*Y)+np.exp(1.7*(X+Y))))
c = plt.contour(EF,EB,a,30)
The output is
It looks like you may need to adjust your parameter space since all the
interesting stuff is around (0,0).

Matplotlib  creating a filled 2d contour plot 
As David said, use contourf:
import numpy as np
import pylab as pl
x,y = np.mgrid[:1:1E3,:1:1E3]
xs = ((x0.3)**2.)
ys = ((y0.5)**2.)
z = np.exp(1*(xs/0.5+ys/0.3))
pl.contourf(x,y,z,20)

Python/Matplotlib  Contour Plot with Bilinear Interpolation 
This one seems to work.
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from scipy.interpolate import interp2d
# http://en.wikipedia.org/wiki/File:Bilininterp.png
xi = np.array([0.0, 1.0])
yi = np.array([0.0, 1.0])
zi = np.array([[0.0, 1.0], [1.0, 0.5]])
# Another example
xi = np.array([0.0, 0.25, 1.0])
yi = np.array([0.0, 0.75, 1.0])
zi = np.array([[0.0, 0.5, 1.0], [0.5, 0.7, 0.5], [1.0, 1.0, 1.0]])
# I want 20 "levels" to be shown
contour_breaks = 20
ticks = np.linspace(zi.min(), zi.max(), contour_breaks, endpoint=True)
# Attempt 4 (interp2d does to correct bilinear interpolation)
fig = plt.figure()
axes = fig.add_subplot(111, aspect='equal')
f = interp2d(xi, yi, zi, kind='linear')
xi2 = np.linspace(0., 1., 100)
yi2 = np.linspace(0., 1

Smooth contour plot in matplotlib from 3 lists of different size 
What you want seems to be a contour plot with a colorbar. You can do
something like:
X, Y = np.meshgrid(x, y, copy=False)
Z = function(X, Y) # I don't know how you are getting the z values from...
import matplotlib.pyplot as plt
plt.contour(X, Y, Z) # nonfilled contour
or
plt.contourf(X, Y, Z) # filled contour
And to create the colorbar:
plt.colorbar()
check the documentation for more details and examples.

How to Smooth a Plot in Matplotlib Without Losing Contour Lines? 
Smoothing data > losing data.
My first reaction is: why do you want to display smoothed data? I've rarely
ever seen data presentations in which data smoothing was actually helpful
for the task of comprehending the data's implications. In fact, it's
something Tufte has often criticized (that's not a reason to avoid doing it
of course, but perhaps for asking yourself to come up with more
justification than normal).
If the plot needs to look pretty for some nondatarelated reason, that's
totally OK, but if you're trying to make it more pleasing to the eye when
the task is to understand something about the nature of the contours,
you're way better off just presenting the raw data as it is.
If you have the different contours stored as separate sets of data (e.g. if
you just steal the diff

Adding an annotation box to a matplotlib contour/heat map plot 
Annotation box to contour map:
Done like this:
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
from numpy.random import randn
from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider
import mpl_toolkits.axes_grid1.axes_size as Size
def make_heights_equal(fig, rect, ax1, ax2, ax3, pad):
# pad in inches
h1, v1 = Size.AxesX(ax1), Size.AxesY(ax1)
h2, v2 = Size.AxesX(ax2, 0.1), Size.AxesY(ax2)
h3, v3 = Size.AxesX(ax3), Size.AxesY(ax3)
pad_v = Size.Scaled(1)
pad_h = Size.Fixed(pad)
my_divider = HBoxDivider(fig, rect,
horizontal=[h1, pad_h, h2, pad_h, h3],
vertical=[v1, pad_v, v2, pad_v, v3])
ax1.set_axes_locator(my_divider.new_locator(0))
ax2.set_axes_locator

How to plot contour of a covariance matrix of a gaussian distribution? 
I finally did what i wanted to do by using a third party function called
plot_gaussian_ellipsoid from the Matlab Central FileExchange.
It plots the contour of the covariance matrix.

matplotlib contour plot with lognorm  colorbar levels 
From here I found an approach that seems to fit your question:
from matplotlib.ticker import LogFormatter
l_f = LogFormatter(10, labelOnlyBase=False)
cbar = plt.colorbar(CF, ticks=lvls, format=l_f)
which will give:
note that the spacing between the ticks are indeed in log scale...

How to show numeric values on a matlab contour plot 
I have solved this issue. I use num2str and apply it on the text command
and it has worked.
here is what i did
fv is the fitness values in my example
strValues = strtrim(cellstr(num2str([fv],'(%d)')));
text(co(:,1), co(:,2),strValues,'VerticalAlignment','top');
the co are the points of the individuals(Pop) in my example.

Matplotlib: Data cubic interpolation (or FIT) for Contour plot 
You can adapt @Joe Kington's suggestion and use scipy.ndimage.zoom which
for your case of a cubic interpolation fits perfectly:
import matplotlib.pyplot as plt
import numpy as np
from scipy.ndimage import zoom
from mpl_toolkits.mplot3d import axes3d
# Receive standard Matplotlib data for 3d plot
X, Y, Z = axes3d.get_test_data(1) # '1' is a step requested data
#Calculate smooth data
pw = 10 #power of the smooth
Xsm = zoom(X, pw)
Ysm = zoom(Y, pw)
Zsm = zoom(Z, pw)
# Create blank plot
fig = plt.figure()
#Create subplots
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
# Plotting
ax1.contour(X, Y, Z)
ax2.contour(Xsm, Ysm, Zsm)
plt.show()
Which gives:

Setting axis values of a 2D contour plot without using xticks 
You can get rid of the error by taking out the extra parenthesis in the
call to contour:
CS=contour(x, y, jres_spec,arange(min_val,max_val,(max_valmin_val)/steps))
If that doesn't give you the plot you want, try xlim and ylim to set the
axis limits directly.

R: how to set the size of a contour plot with user defined aspect ratio? 
Try this
x < 10*1:nrow(volcano)
y < 10*1:ncol(volcano)
filled.contour(x, y, volcano,asp=1, frame.plot=F,
plot.axes = { axis(1, pretty(x,min=0), line=4)
axis(2, seq(0, 600, by = 100)) })

weird contour plot with polar projections using matplotlib and basemap 
Your Basemap object (m) also serves as the mpl axes. When plotting, you
should use that instead of using plt.. So:
m.contourf(x,y,TS2, fbot_levels, origin='lower')
Stretching the levels between 0.5 and 0.9 highlights the different contours
further.

matplotlib contour plot: proportional colorbar levels in logarithmic scale 
I propose to generate a pseudo colorbar as follows (see comments for
explanations):
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LogNorm
import matplotlib.gridspec as gridspec
delta = 0.025
x = y = np.arange(0, 3.01, delta)
X, Y = np.meshgrid(x, y)
Z1 = plt.mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = plt.mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 1e6 * (Z1 * Z2)
fig=plt.figure()
#
# define 2 subplots, using gridspec to control the
# width ratios:
#
# note: you have to import matplotlib.gridspec for this
#
gs = gridspec.GridSpec(1, 2,width_ratios=[15,1])
# the 1st subplot
ax1 = plt.subplot(gs[0])
lvls = np.logspace(0,4,20)
CF = ax1.contourf(X,Y,Z,
norm = LogNorm(),
levels = lvls

how to draw a filled.contour plot with a data.frame of 3 variables in R (without regular grid)? 
Thanks !!! It works !! From the time I was looking for...
Here's what I did :
library(akima)
my.heat.colors < function(x) { rev(heat.colors(x, alpha=1)) }
my.matrix < interp(X,Y,Z)
ind.mat.na < which(is.na(c(my.matrix$z)))
my.matrix$z[ind.mat.na] < 0
filled.contour(my.matrix, nlevels=10, color=my.heat.colors)
And now I will plot contours on this.
Thank you again !

Python: find contour lines from matplotlib.pyplot.contour() 
You can get the vertices back by looping over collections and paths and
using the iter_segments() method of matplotlib.path.Path.
Here's a function that returns the vertices as a set of nested lists of
contour lines, contour sections and arrays of x,y vertices:
import numpy as np
def get_contour_verts(cn):
contours = []
# for each contour line
for cc in cn.collections:
paths = []
# for each separate section of the contour line
for pp in cc.get_paths():
xy = []
# for each segment of that section
for vv in pp.iter_segments():
xy.append(vv[0])
paths.append(np.vstack(xy))
contours.append(paths)
return contours
Edit:
It's also possible to compute the contours without plotting

Using matplotlib.animate to animate a contour plot in python 
This is the line:
cont, = ax.contourf([], [], [], 500)
change to:
x = linspace(0, 200, Nx)
y = linspace(0, 100, Ny)
x, y = meshgrid(x, y)
z = n[i,:,0,:].T
cont, = ax.contourf(x, y, z, 500)
You need to intilize with sized arrays.

drawing plot lines on QGraphicsScene 
I'd say QPainter::drawPolyline() is a good option (or
QPainterPath::addPolygon). You can use QPolygonF to contain your points.
Then you just pass this to the QPainter's drawPolyline function.
QPolygonF polyline;
polyline.append(QPointF(x, y)); // add your points
painter>drawPolyline(polyline);
or
QPainterPath painterPath;
painterPath.addPolygon(polyline);

Drawing xy plot with rhombus width and height controlled by xError and yError in R 
You can use the my.symbols and ms.polygon functions in the TeachingDemos
package to draw the rhombuses:
library(TeachingDemos)
plot(c(5,10), c(5,5), xlab = expression(Age), ylab = expression(value),
type="n")
my.symbols( Age, value, ms.polygon, n=4, xsize=2*Age_error,
ysize=2*value_error, linesfun=polygon, col='grey' )
Leave out linesfun and col if you don't want the rhombuses filled.

Inacurate tracking when drawing calcOpticalFlow's outputed feature vector 
In my opinion you can't use camera.set(CV_CAP_PROP_POS_FRAMES,
currentFrame) on a webcam, but I 'm not positive about that.
Instead I suggest you to save the previous frame in your prevFrame
variable.
As an example I can suggest you this working code, I only change inside the
while loop and I add comment before all my adds :
while(true)
{
if (destroyBox)
{
cv::destroyAllWindows();
break;
}
camera >> cameraFrame;
if (cameraFrame.empty())
{
std::cerr << "ERROR: Could not grab a camera frame." <<
std::endl;
exit(1);
}
// new lines
if(prevFrame.empty()){
prevFrame = cameraFrame;
continue;
}
// end new lines
//camera.set(CV_CAP_PROP_POS_FRAMES, currentFrame);
/

plot numeric vector with names as x ticks 
You can use function axis() to add labels. Argument xaxt="n" inside plot()
will make plot without x axis labels (numbers).
plot(quantity,xaxt="n")
axis(1,at=1:3,labels=names(quantity))

matplotlib bitmap plot with vector text 
It should be as simple as passing in rasterized=True to the plot command.
E.g.
import matplotlib.pyplot as plt
plt.plot(range(10), rasterized=True)
plt.savefig('test.pdf')
For me, this results in a pdf with a rasterized line (the resolution is
controlled by the dpi you specified with savefig  by default, it's 100)
and vector text.

how to make qplot produce a line plot with one vector of data 
When I run plot(1:100), I get a points plot with x = seq_along(y), y =
1:100
to get the same plot using qplot, all you need to run is
plot(1:100)
qplot(y = 1:100)
Within qplot there is
if (missing(x)) {
aesthetics$x < bquote(seq_along(.(y)), aesthetics)
}
geom[geom == "auto"] < "point
which deals with this.
qplot(1:100) will be parsed as qplot(x = 1:100) (using positional
matching), and is dealt with by
if (missing(y)) {
geom[geom == "auto"] < "histogram"
if (is.null(ylab))
ylab < "count"
}

Is there an equivalent for data frames to the following code for vectors: unsampled.vector < original.vector[sampled.vector,] 
You should probably save the value of the sample, then you can use negative
indexing just as you would in a vector:
sample_df < mydf[s < sample(nrow(mydf),10),]
remainder_df < mydf[s,]
Or more comprehensibly
s < sample(nrow(mydf),10)
sample_df < mydf[s,]
remainder_df < mydf[s,]

Monogame not drawing vertex buffered cubes, only drawing GraphicsDevice.Clear colour 
Thanks for all the help guys.
I fixed the issue by changing
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 12);
to
graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, newVertices,
0, 12);

Drawing an outer shadow when drawing an image 
Here we go
Yup I still dig the Nexus S
First of all, please stop masking bitmaps that way, you can accomplish this
without allocating another Bitmap, checkout this blog post about how to
draw rounded (and actually any shape) images.
Second using that Drawable you probably can figure out how to add your
shadow, just make sure it does not get clipped, on 18+ you could use
ViewOverlays for that, also keep in mind that there are several unsupported
drawing operations for hardware accelerated layers, that includes
setShadowLayer and BlurMaskFilter, if performance is not an issue for you,
you can disable it as always:
if (SDK_INT >= HONEYCOMB) {
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
And use setShadowLayer as you were trying already:
somePaint.setShadowLayer(shadowSize

OpenGL drawing in QDeclarativeItem messes up other QML drawing 
The problem was caused from loading our texture data to the default texture
object, which was also used by QML framework. Solution was to generate and
bind unique textures in our own texture handling. For a OpenGL beginner
like me this was a great lesson about texture handling.
To handle other OpenGL state changes, it was sufficient to add
glPushAttrib(GL_ALL_ATTRIB_BITS) and glPopAttrib() around our drawing.

It is possible to have all the axes displayed in the ilnumerics surface plot without affecting the plot size? 
The extend occupied by the plot cube data groups is controlled by the
ILPlotCube.DataScreenRect property. It defines the data area of the plot
cube rectangle only  ignoring the space used by labels and axes.
The DataScreenRect is automatically adjusted by default  depending on the
sizes of axes (fonts, text heights), ticks, and tick labels configuration.
By defining the DataScreenRect area yourself, you risk that some of these
elements will move outside the visible area. Therefore, to enable optimal
visibility for all elements, you may adjust the properties for label
positions, and ticks as well.
DataScreenRect in the online manual:
http://ilnumerics.net/advancedconfigurations.html
DataScreenRect in the class reference:
http://ilnumerics.net/apidoc/html/P_ILNumerics_Drawing_Plott

core plot scatter plot x y axis label not being displayed correctly 
Change any references to _hostView.hostedGraph.graph to
_hostView.hostedGraph. The graph property is inherited from CPTLayer. It is
used by other parts of the graph to maintain a pointer to the graph, but
not by the graph itself.

How do I plot multiple data subset forecast predictions onto a single plot 
This is answered in another post Is there an easy way to revert a forecast
back into a time series for plotting?
This was initially posted as two unique questions, but they have the same
answer.
The core question being addressed is "how to restore the original time
stamps to the forecast data". What I have learned with trial and error is
"configure, then never loose the time series attribute" by applying these
steps:
1: Make a time series Use the ts() command and create a time series.
2: Subset a time series Use 'window()' to create a subset of the time
series in 'for()' loop. Use 'start()' and 'end()' on the data to show the
time axis positions.
3: Forecast a time series Use 'forecast()' or 'predict()' which operate on
time series.
4: Plot a time series When you plot a time series, the

Core plot prevent zooming/scaling of plot to show full axes range 
Is more a hint than an answer.. but, as I already said in comments:
you can try to remove "scaleToFitPlots" and set xRange and yRange directly;
or..
call scaleToFitPlots: and then set the xRange afterwards

Error while storing ggplots in list. Impossible to plot multiple ggplot, but possible to plot them seperately 
Maybe you are looking for facet_wrap as Roland suggested.
dat < yourdata
Get the mean and plot using facet_wrap
moyparam<ddply(dat, .(Date), function(x)
data.frame(Mesure=mean(x$Mesure)))
moyparam$Annee < 1900 + as.POSIXlt(moyparam$Date)$year
ggplot(moyparam, aes(Date, Mesure)) + geom_point() + theme_bw() +
facet_wrap(~Annee, scales="free")

Iteration: sum of variable and vector front, export in another vector, erase vector front 
Let's make this a bit simpler by taking out all the domainspecific stuff,
and just discuss the basic question:
[How do I] put the front value of vectorA in a local variable to add
it to SUM, and then erase this front value?
Here is a simple approach:
vector <double> vectorA;
double SUM = 0.0;
// ...
while (!vectorA.empty())
{
const double curVal = vectorA.front(); // this strictly isn't necesarry.
the compiler might optimize this away
SUM += curVal;
vectorA.erase (vectorA.begin());
}
Now let's incorporate u:
vector <double> vectorA;
double SUM = 0.0;
const double u = /* ??? */;
// ...
while (!vectorA.empty())
{
const int curVal = vectorA.front(); // this strictly isn't necesarry.
the compiler might optimize this away
if (curVal > SUM)
{
SU

coreplot scatter plot not showing with only one data point 
The scaleToFitPlots: method doesn't have enough information from only one
data point to calculate "reasonable" axis ranges. In that case, set the
xRange and yRange yourself based on the data you do have.

Add axis label to plot in matplotlib, by passing them as arguments to plot() 
As @nordev already explained, you cannot pass through plot() the axis
label, but inside your function you can get the active figure and then set
the axis labels like the example below:
import matplotlib.pyplot as plt
def plot_something(x, y, **kwargs):
title = kwargs.pop( 'title' )
xlabel = kwargs.pop( 'xlabel' )
ylabel = kwargs.pop( 'ylabel' )
plt.figure()
plt.plot(x, y, **kwargs)
fig = plt.gcf()
for axis in fig.axes:
axis.set_title( title )
axis.xaxis.set_label( xlabel )
axis.yaxis.set_label( ylabel )
return axis
plot_conf = {'title': 'Blabla', 'xlabel':'Time (s)', 'ylabel': 'Speed
(m/s)'}
x = [1.,2.,3.]
y = [1.,4.,9.]
axis = plot_something(x=x,y=y, **plot_conf)

HighCharts range area plot not working when plot is inverted 
Torstein at HighCharts has implemented a fix to this bug that is in his
GitHub repo:
https://github.com/highslidesoftware/highcharts.com/commit/905535d2c56d61d034eed84eccf50e3bb44e1911
And he's posted an example here:
see http://jsfiddle.net/highcharts/Tt485/2/
I tried his fix and it worked perfectly.
He's planning a maintenance release soon to post the fix.


