Using matlab to change the color of the polygons of a map from a shp file - matlab

My question is that how do I change the polygons of a map from shp file (shapefile) while using matlab. I was doing this project where i was given map in shpfile format that I need to use on, I am able to read the map in matlab but the map is divide in regions and each regions have its color, my problem I met was to change the polygons to its respective colors, anyone sees this please kindly help and reply me asap.

Are you using the Mapping Toolbox by The MathWorks, or third-party codes such as ones from the Shapefile C Library to import the shapefile? If you are using the Mapping Toolbox, I cannot be of much help here as I do not have that toolbox -- hopefully, someone else can help here.
In any case, if you could import the shapefile on to your MATLAB Workspace, you should be able to find the vector data (polygons and attributes data, etc.) somewhere...
If you do not see anything on the Workspace, possibly you can find those data in the Figure (or in the Axis).
data=get(the_handle);
I would look for the data there.
After you obtain the polygon and properties data, you can patch/fill them with any color you like (based on any other information you find there.)
Good Luck

Related

How To Plot custom images as markers over a Polarplot()?

I want to create a polarplot() on which I want to plot custom bitmaps/images as marker.
Also, I want to animate the polarplot() by updating these marker's location in regular time intervals(500milliseconds).
Please see the below attached image to get an idea what I want.
SamplePlotExample.jpg
I have made a similar application using 'polar()' and 'imagesc()'.
But I feel 'polarplot()' is better and recommended by Matlab.
Also there are so many customization options available with polarplot().
But I am unable to use imagesc() with polarplot because of some polar coordinate-to-cartersian coordinate conversion problem.
Pleas give solution.
Is there any other better methods to follow?

Paraview visualization help ("density/mist" plot?!)

I am trying to visualize a data set (x,y,z,scalar) in comma separated values format. The style I want to recreate is something like a transparent 3d heat map. The value of scalar at coordinate (x,y,z) will determine the "mist density". No idea what the name of the style is. Links below give examples of what I mean:
https://www.paraview.org/wp-content/uploads/2014/04/densityoverlay.png
or
http://www.scidac.gov/Conference2006/speaker_abs/AhrensPic.jpg
Any references would be most useful as I am new to data visualizing.
Take a look at the Point Volume Interpolate filter with Kernel set to GaussianKernel.

How to make a DEM in QGIS using spot heights and contors

I have 2 shapefiles. One is the contors of an area and the other the spot heights. Both of them has a altitude attribute. In ArcGIS there is a tool called topo to raster were you can use both these features to create a dem. In qgis I have only found tools were you can only use one.
Any Ideas?
There is only the interpolation tool that I know of which will create a DEM. Depending on the resolution you're after, you could BUFFER the spot heights, then MERGE SHAPE FILES and run the interpolation tool on that.
Using the graphical modeler would prevent the buffer layer being created making the process a little tidier (and i'm sure there's a better way using the python console). Hope this helps.

How to visualize correlation matrix as a schemaball in Matlab

I have 42 variables and I have calculated the correlation matrix for them in Matlab. Now I would like to visualize it with a schemaball. Does anyone have any suggestions / experiences how this could be done in Matlab? The following pictures will explain my point better:
In the pictures each parabola between variables would mean the strength of correlation between them. The thicker the line is, the more correlation. I prefer the style of picture 1 more than the style in picture 2 where I have used different colors to highlight the strength of correlation.
Kinda finished I guess.. code can be found here at github.
Documentation is included in the file.
The yellow/magenta color (for positive/negative correlation) is configurable, as well as the fontsize of the labels and the angles at which the labels are plotted, so you can get fancy if you want and not distribute them evenly along the perimeter/group some/...
If you want to actually print these graphs or use them outside matlab, I suggest using vector formats (eg eps). It's also annoying that the text resizes when you zoom in/out, but I don't know of any way to fix that without hacking the zoom function :/
schemaball % demo
schemaball(arrayfun(#num2str,1:10,'uni',false), rand(10).^8,11,[0.1587 0.8750],[0.8333 1],2*pi*sin(linspace(0,pi/2-pi/20,10)))
schemaball(arrayfun(#num2str,1:50,'uni',false), rand(50).^50,9)
I finished and submitted my version to the FEX: schemaball and will update the link asap.
There are a some differences with Gunther Struyf's contribution:
You can return the handles to the graphic object for full manual customization
Labels are oriented to allow maximum left-to-rigth readability
The figure stretches to fit labels in, leaving the axes unchanged
Syntax requires only correlations matrix (but allows optional inputs)
Optimized for performance.
Follow examples of demo, custom labels and creative customization.
Note: the first figure was exported with saveas(), all others with export_fig.
schemaball
x = rand(10).^3;
x(:,3) = 1.3*mean(x,2);
schemaball(x, {'Hi','how','is','your','day?', 'Do','you','like','schemaballs?','NO!!'})
h = schemaball;
set(h.l(~isnan(h.l)), 'LineWidth',1.2)
set(h.s, 'MarkerEdgeColor','red','LineWidth',2,'SizeData',100)
set(h.t, 'EdgeColor','white','LineWidth',1)
The default colormap:
To improve on screen rendering you can launch MATLAB with the experimental -hgVersion 2 switch which produces anti/aliased graphics by default now (source: HG2 update | Undocumented Matlab). However, if you try to save the figure, the file will have the usual old anti-aliased rendering, so here's a printscreen image of Gunther's schemaball:
Important update:
You can do this in Matlab now with the FileExchange submission:
http://www.mathworks.com/matlabcentral/fileexchange/48576-circulargraph
There is an exmample by Matlab in here:
http://uk.mathworks.com/examples/matlab/3859-circular-graph-examples
Which gives this kind of beautiful plots:
Coincidentally, Cleve Moler (MathWorks Chief Mathematician) showed an example of just this sort of plot on his most recent blog post (not nearly as beautiful as the ones in your example, and the connecting lines are straight rather than parabolic, but it looks functional). Unfortunately he didn't include the code directly, but if you leave him a comment on the post he's usually very willing to share things.
What might be even nicer for you is that he also applies (and this time includes) code to permute the rows/columns of the array in order to maximize the spatial proximity of highly connected nodes, rather than randomly ordering them around the circumference. You end up with a 'crescent'-shaped envelope of connecting lines, with the thick bit of the crescent representing the most highly connected nodes.
Unfortunately however, I suspect that if you need to enhance his code to get the very narrow, high-resolution lines in your example plots, then MATLAB's currently non-anti-aliased graphics aren't quite up to it yet.
I've recently been experimenting with MATLAB data and the D3 visualization library for similar graphs - there are several related types of circular visualizations you may be interested in and many of them are interactive. Another helpful, well-baked, and freely available option is Circos which is probably responsible for most of the prettier versions of these graphs you've seen in popular press.

How to manually segment and label ROIs in an image in Matlab?

I'm a newbie to Matlab. I'm basically attempting to manually segment a set of images and then manually label those segments also. I looked into the imfreehand(), but I'm unable to do this using imfreehand().
Basically, I want to follow the following steps :
Manually segment various ROIs on the image (imfreehand only lets me draw one segment I think?)
Assign labels to all those segments
Save the segments and corresponding labels to be used further (not sure what format they would be stored in, I think imfreehand would give me the position and I could store that along with the labels?)
Hopefully use these labelled segments in the images to form a training dataset for a neural network.
If there is some other tool or software which would help me do this, then any pointers would be very much appreciated. (Also I am new to stackoverflow, so if there is any way I could improve on the question to make it clearer, please let me know!) Thanks!
Derek Hoiem, a computer vision research at the University of Illinois, wrote an object labelling tool which does pretty much exactly what you asked for. You can download it from his page:
http://www.cs.illinois.edu/homes/dhoiem/software/index.html