9 Downloads
Updated 20 Aug 2004
No License
This function is similar to MATLAB's own scatter3 routine. PLOTC(X,Y,V) plots the values specified in V as a color coded scatter plot at the locations specified in the vectors X and Y. The current colormap of the figure is used for the color code.
Ulrich Theune (2021). plotc (https://www.mathworks.com/matlabcentral/fileexchange/5718-plotc), MATLAB Central File Exchange. Retrieved .
Inspired: plotclr, color coded 2D scatterplot
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
Hi, I am using the matlab v2016b. And this code doesn't work normally that the colormap always is only yellow. Any suggestions on how to solve this problem?
I am using this code with a dataset containing over 1,000,000 data points. The code doesn't seem to handle this many points very well and takes a long time to complete. Any suggestions on how to make it faster?? Otherwise, the code works great!
please read and try out this superb trik by Jos
Phil Tresadern wrote:
>
>
> skolpojken72 wrote:
>>
>>
>> How do i make MATLAB plot a 2D-graph and assign different
colors
> to
>> each dot?
>>
>> I want to plot a 2D-graph with pos_x and pos_y with pos_color.
>>
>> With a command like this:
>>
>> plot(pos_x, pos_y)
>>
>> , I would want to do something like this:
>>
>> plot(pos_x, pos_y, pos_color)
>>
>> All vectors are the same length.
>>
>> If you understand what i mean :-)
>>
>>
>
> Use the scatter function. This is *much* quicker than using
> multiple
> plots via 'hold'. Note that this works best using an indexed
> colormap.
If speed is an issue, this is really much quicker than scatter
approach, which itself is only marginally faster then the "hold on +
for loop".
h = plot(1,pos_y,'b.') ;
for i=1:length(pos_x),
set(h(i),'xdata',pos_x(i),'Color',pos_color(i,:)) ;
end
However, I agree that the OP is better helped with the
<scatter> solution.
Jos
ocn