I am trying to generate some contour plots using data in netCDF format in Matlab. I've managed to load in the data and retrieve latitude, longitude information, but got bit stuck in making the plot looks right. The thing I want to change is the locations of the longitude labels. Now they are labelled along the equator (see Fig below), making them difficult to read. I want to move them to the bottom of the plot. Please give me some clue how to control this.
Here is the block of code that I am developing that creates the plot:
latax=-89:1:89;
lonax=0:1:360;
figure
axesm('braun','MLabelParallel',-60);
worldmap([latax(1),latax(end)],[lonax(1),lonax(end)]);
hold on;
load coast;
plotm(lat,long,'k-');
where latax and lonax are the latitude and longitude vectors, respectively. I thought the line axesm('braun','MLabelParallel',-60); sets the latitudinal location for the longitude labels but it didn't seem to make any difference.
The position of these labels can be controlled with the setm command (I'm using 2015a). If your worldmap axes are defined as:
ax = worldmap([latax(1),latax(end)],[lonax(1),lonax(end)]);
to put the labels at the bottom of the plot, do
setm(ax,'mlabelparallel',-90)
the 'plabelmeridian' is the equivalent property for the latitude labels.
Related
I am charting the values of the DISC personality test on a google chart.
Location on the X-axis is Influence - Compliance.
Location on the Y-axis is Dominance - Steadiness.
I've tried every combination of Data Ranges, Identifying X-Axis, Adding Labels, going through common errors - https://infoinspired.com/google-docs/spreadsheet/common-errors-in-scatter-chart/
I cannot seem to get each person's score to populate correctly on the X-Y axis along with their names as the label.
The sheet is located here: https://docs.google.com/spreadsheets/d/1Aq8bCIDCpdW8XXnwDcd8bOAwH0KCPs5-a-6-saJITxg/edit#gid=499653271
it would need to be like this:
__________________________________________________________
UPDATE:
I have a plot showing a map in a pcolor plot in Matlab R2012a/R2014a (=using the old graphic system) and want to implement panning and zooming.
Because the dataset is quite large (and needs to be interpolated from vector data), I would prefer not to plot the whole region at high resolution, but only a small fraction of it and then pan around. But I want to redo the plot once I pan out of this subregion, such that it contains the next subregion.
Is there some way to get the limits of the region with data in an axes object the same way I can the limits of the currently displayed region via get(myAxes, '[XY]lim')? This way I could replot only if necessary.
A workaround would be to store the limits inside a handles structure everytime I execute pcolor, but I wonder if there is something built ín for this case.
I found a solution.
The region is not stored in the axes object itself, but in one of its children (the one containing the actual plot). It is if type surface for pcolor plots and hggroup for contour plots. So you can find it via
childHandle = plotfindall(myAxes, 'Type', 'surface')
This object contains all the data used for plotting in its properties XData, YData and ZData. The largest x value with data and already plotted (but maybe not in the visible range) can be determined via
xd = get(childHandle, 'XData');
maximumXWithData = max(xd(:));
Can anyone help me how to plot latitude and longitude on a world map using matlab. I have the mapping toolbox and have been trying to use the function geoshow, however I can´t get it right. I plot the world map using plot_google_map:
plot(lon,lat,'.k','MarkerSize',6)
hold on
plot_google_map('maptype','roadmap')
This is the figure I get:
However I am not able to get the latitude and longitude grid on this picture.
I'm not sure is this going to help, but try reversing the order of your plot statements - its possibly that the map plot may be overwriting all the data of the lon and lat data.
Alternatively, if the function allows for it, plot the map as the back layer.
I am creating scatter graph, I need to change the x and y positions in scatter graph. Graph always starts with (0,0) positions but i need to show the starting points (7000, 800). Is there any way to change the x and y positions in scatter graph in core plot.
After showing the graph need to draw the line manually and get those values to search the properties.
Please help me.
Thanks in advance.
to set the point where the co-ordinates meet you have to set the orthogonal co-ordinate decimal
x.orthogonalCoordinateDecimal = CPTDecimalFromString(#"800");
y.orthogonalCoordinateDecimal = CPTDecimalFromString(#"740000");
and for setting the range of values to be plotted set the visibleRange for both the axes
These are features of the "plot space" in Core Plot. It defines the coordinate mapping between the plot area (basically the rectangle that contains all plot drawing) in data coordinates and the view in drawing coordinates. The xRange and yRange control the x and y range of the plot space, respectively.
The plot space converts coordinates in both directions—from data to view when drawing and from view to data when (for example) responding to touch events on a plot. See the plot space docs for a list of the available coordinate conversion methods.
I have two two-by-n arrays, representing 2d-points. These two arrays are plotted in the same figure, but in two different subplots. For every point in one of the arrays, there is a corresponding point i the other array. I want to show this correspondance by drawing a line from one of the subplots to the other subplot.
The solutions i have found are something like:
ah=axes('position',[.2,.2,.6,.6],'visible','off'); % <- select your pos...
line([.1,.9],[.1,.9],'parent',ah,'linewidth',5);
This plots a line in the coordinate system given by the axes call. In order for this to work for me i need a way to change coordinate system between the subplots system and the new system. Anybody know how this can be done?
Maybe there is different way of doing this. If so i would love to know.
First you have to convert axes coordinates to figure coordinates. Then you can use ANNOTATION function to draw lines in the figure.
You can use Data space to figure units conversion (ds2nfu) submission on FileExchange.
Here is a code example:
% two 2x5 arrays with random data
a1 = rand(2,5);
a2 = rand(2,5);
% two subplots
subplot(211)
scatter(a1(1,:),a1(2,:))
% Convert axes coordinates to figure coordinates for 1st axes
[xa1 ya1] = ds2nfu(a1(1,:),a1(2,:));
subplot(212)
scatter(a2(1,:),a2(2,:))
% Convert axes coordinates to figure coordinates for 2nd axes
[xa2 ya2] = ds2nfu(a2(1,:),a2(2,:));
% draw the lines
for k=1:numel(xa1)
annotation('line',[xa1(k) xa2(k)],[ya1(k) ya2(k)],'color','r');
end
Make sure your data arrays are equal in size.
Edit: The code above will do data conversion for a current axes. You can also do it for particular axes:
hAx1 = subplot(211);
% ...
[xa1 ya1] = ds2nfu(hAx1, a1(1,:),a1(2,:));
A simple solution is to use the toolbar in the figure window. Just click "insert" and then "Line".