Matlab multiple graph types inside one graph - matlab

I have a task to draw electrostatic field between
two electrodes( at given sizes and shape ),
what i have now is that i draw the electrodes with area plot (area(elect_x,elect_y))
the graph looks like this:
------------------.---
|..
.---. |..
|...| |..
.----....| |..
|........| |..
----------------------
and now i would need to draw inside this probably a mesh, showing the field.
Is there any way to do it, or i´m on a wrong way?
Thank you very much for every guide

First, if you want to overlay multiple plots in the same axes, type
hold on
before you plot the second graph (or set the 'NextPlot' property of the axes to 'add'), so that the first plot is not erased when the second one is drawn.
To show electrical field, you may want to have a look at quiver, so you can visualize both direction and strength of the fiels. Also check out is demo of quiver to get and idea how you could show field strength with colors.

Related

ParaView: How to decide which contour filter is on top?

I load two data files into paraview and use on both one contour filter. The resulting contour lines overlap. What I want and tried is the following:
load data file 1 into paraview, apply contour filter 1 on it.
load data file 2 into paraview and apply contour filter 2 on it.
Now I would expect that the contour filter 2 is on top of the first one at the overlapping area. But this is not the case.
Contour filter 2 contains only the black line. The first contour filter contains all the others. In the image the green-yellow-ish contour line is on top of the black one from filter 2.
Hopefully someone can help me.
Thank you!
ParaView mostly relies on distance from the camera to determine what objects are rendered "on top". Probably the best way to make sure that the lines of one of the objects are rendered over the other is to displace one or both in the z direction. You can do that by modifying the Translation under the Transforming parameters of the display properties. I see in your screenshot that you have a 2D projection, so shifting the data in the Z direction should have no visible effect other than the distance to the camera.
You can achieve the same effect using the Transform filter.

Overlap plots in MATLAB

I currently have a contour plot, just like this one here
http://www.originlab.com/www/helponline/Origin/en/mergedProjects/Tutorial/images/Contour_Plot_with_Major_and_Minor_Levels_Filled_by_Using_Color_Palette/Graph_Gallery_Contour_Plot_Palette_16.png,
now I want to add some simple plots of functions in the length width plane, like f(width) = width^n and so on, but I don't know how to overlap these two plots.
So, you want to retain the current graph when adding new graphs: use hold on. See http://www.mathworks.nl/help/matlab/ref/hold.html.

How to define Matlab Bar3 DisplayName for individual surface objects

I have a series of histograms being plotted along side each other in a bar3 plot. I'd like to take advantage of the plot browser to turn on and off various histograms so I can do side by side comparisons. You can see from the properties Inspector that I've altered the display name for one such surface, the third, that is being updated in the legend but not in the property browser.
There's also a misregistration of the colors you see in the legend to that of the actual plot. The legend is accurate only when I have all surfaces checked for display.
I'm using MATLAB Version 7.13.0.564 (R2011b)
Thanks for helping
Toggle the legend off and on with legend('off') followed by legend('show'). Try also legend('toggle').

Matplotlib: annotating plots with arbitrary shapes

Hi I would like to be able to add arbitrary shapes to an x-y plot. Here's an example:
As you can see in the above plot, there's a horizontal annotation line that contains arrows and cylinders. Ultimately I'd like to be able to pass a list of chars [None, "a","a","a",None,"c","c","c", None, etc...] and add that annotation below the plot, or on the x-axis.
Can someone please suggest a way to do this, or comment if it's even possible. Also if adding arrows/cylinders is too difficult, just adding different color of simple rectangles will be fine.
Thanks in advance!
It is indeed possible to add shapes like you describe to at maplotlib axes object. See this example:
http://matplotlib.org/examples/shapes_and_collections/artist_reference.html
So you need to do two things:
use ax.get_xlim() and np.linspace(xmin, xmax, num_shapes) to figure out the x-coordinates of your each of your artists
write a function to add the shapes as shown in the example with the axes object, artist type, and x-y coordinates as arguments.

Single Axis Simulation in Matlab

Hi i wanted to generate a single axis graph (dont know if this is called a graph exactly) in matlab something like this
In the above image the numerical values represent time ( 1 till 23) min and the vertical thin black lines represent event A . Some of the vertical black lines have a red circle on top denoting occurrence of an event B along with the event A. Is it possible to generate such a simulated image in matlab ? If so what keywords should i look for. Any suggestions to get me quickly started on generating such a graph/Simulation. (Note: I havent actually used matlab a lot.. certainly never generated graphs in it)
You probably want a stem graph, and then do something like:
stem(event_times, ones(size(event_times));
You can overlay multiple graphs to get the red circles, etc.