<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 11pt; font-family: "Book Antiqua",Palatino,serif'>
<p>Thank you Samuel for your idea of extending current colormap. As I understant there is no connection between the color and value of T for each polyline in your proposition. As I wrote in my second post I've managed to solve this problem. Maybe you could look at my second problem described there?</p>
<p>Regards,</p>
<p>Iza</p>
<div id="signature">---<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"><span style="font-family: book antiqua, palatino, serif;">Izabela Wójcik-Grząba</span><br /><span style="font-family: book antiqua, palatino, serif;">Zespół Konstrukcji Metalowych</span><br /><span style="font-family: book antiqua, palatino, serif;">ZKBiM IIB WIL Politechnika Warszawska</span><br /><br /></div>
</div>
<p><br /></p>
<p id="reply-intro">W dniu 16.11.2021 09:46, Samuel Gougeon napisał(a):</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="replybody1">
<div>
<div class="v1moz-cite-prefix">Hello Izabela,</div>
<div class="v1moz-cite-prefix"> </div>
<div class="v1moz-cite-prefix">The current colormap is always stored as a figure's property, as shown for instance in the examples at <a class="v1moz-txt-link-freetext" href="https://help.scilab.org/docs/6.1.1/en_US/colormap.html" target="_blank" rel="noopener noreferrer">https://help.scilab.org/docs/6.1.1/en_US/colormap.html</a></div>
<div class="v1moz-cite-prefix">Here is a possible implementation (without the gsort stuff):</div>
<div class="v1moz-cite-prefix">
<pre style="font-family: Monospaced; font-style: normal; font-size: 12.0;"><span style="color: #000000;">X</span> <span style="color: #5c5c5c;">=</span> <span style="color: #4a55db;">[</span><span style="color: #bc8f8f;">0.5</span> <span style="color: #bc8f8f;">1.5</span> <span style="color: #bc8f8f;">1.5</span> <span style="color: #000000;">;</span> <span style="color: #bc8f8f;">1.5</span> <span style="color: #bc8f8f;">2.5</span> <span style="color: #bc8f8f;">1.5</span><span style="color: #4a55db;">]</span><span style="color: #000000;">;</span>
<span style="color: #000000;">Y</span> <span style="color: #5c5c5c;">=</span> <span style="color: #4a55db;">[</span><span style="color: #bc8f8f;">0.5</span> <span style="color: #bc8f8f;">1</span> <span style="color: #bc8f8f;">1</span> <span style="color: #000000;">;</span> <span style="color: #bc8f8f;">1</span> <span style="color: #bc8f8f;">0.5</span> <span style="color: #bc8f8f;">2</span><span style="color: #4a55db;">]</span><span style="color: #000000;">;</span>
<span style="color: #000000;">Z</span> <span style="color: #5c5c5c;">=</span> <span style="color: #4a55db;">[</span><span style="color: #bc8f8f;">0</span> <span style="color: #bc8f8f;">1</span> <span style="color: #bc8f8f;">1</span> <span style="color: #000000;">;</span> <span style="color: #bc8f8f;">1</span> <span style="color: #bc8f8f;">2</span> <span style="color: #bc8f8f;">3</span><span style="color: #4a55db;">]</span><span style="color: #000000;">;</span>
<span style="color: #000000;">clf</span>
<span style="color: #32b9b9;">param3d1</span><span style="color: #4a55db;">(</span><span style="color: #000000;">X</span><span style="color: #000000;">,</span><span style="color: #000000;">Y</span><span style="color: #000000;">,</span><span style="color: #000000;">Z</span><span style="color: #4a55db;">)</span><span style="color: #000000;">;</span>
<span style="color: #000000;">h</span> <span style="color: #5c5c5c;">=</span> <span style="color: #000000;">gca</span><span style="color: #4a55db;">(</span><span style="color: #4a55db;">)</span><span style="color: #5c5c5c;">.</span><span style="color: #aaaaaa;">children</span><span style="color: #4a55db;">(</span><span style="color: #bc8f8f;">1</span><span style="color: #4a55db;">)</span><span style="color: #5c5c5c;">.</span><span style="color: #aaaaaa;">children</span><span style="color: #000000;">;</span>
<span style="color: #000000;">ccm</span> <span style="color: #5c5c5c;">=</span> <span style="color: #000000;">gcf</span><span style="color: #4a55db;">(</span><span style="color: #4a55db;">)</span><span style="color: #5c5c5c;">.</span><span style="color: #aaaaaa;">color_map</span><span style="color: #000000;">;</span>
<span style="color: #000000;">ncurv</span> <span style="color: #5c5c5c;">=</span> <span style="color: #32b9b9;">size</span><span style="color: #4a55db;">(</span><span style="color: #000000;">X</span><span style="color: #000000;">,</span><span style="color: #bc8f8f;">2</span><span style="color: #4a55db;">)</span><span style="color: #000000;">;</span>
<span style="color: #000000;">ncol</span> <span style="color: #5c5c5c;">=</span> <span style="color: #32b9b9;">size</span><span style="color: #4a55db;">(</span><span style="color: #000000;">ccm</span><span style="color: #000000;">,</span><span style="color: #bc8f8f;">1</span><span style="color: #4a55db;">)</span><span style="color: #000000;">;</span>
<span style="color: #64ae64; font-style: italic;">// proposal : extending the current color map, instead of replacing it:</span>
<span style="color: #000000;">gcf</span><span style="color: #4a55db;">(</span><span style="color: #4a55db;">)</span><span style="color: #5c5c5c;">.</span><span style="color: #aaaaaa;">color_map</span> <span style="color: #5c5c5c;">=</span> <span style="color: #4a55db;">[</span><span style="color: #000000;">ccm</span> <span style="color: #000000;">;</span> <span style="color: #000000;">jetcolormap</span><span style="color: #4a55db;">(</span><span style="color: #000000;">ncurv</span><span style="color: #4a55db;">)</span><span style="color: #4a55db;">]</span><span style="color: #000000;">;</span>
<span style="color: #000000;">h</span><span style="color: #5c5c5c;">.</span><span style="color: #aaaaaa;">thickness</span> <span style="color: #5c5c5c;">=</span> <span style="color: #bc8f8f;">4</span><span style="color: #000000;">;</span>
<span style="color: #000000;">h</span><span style="color: #5c5c5c;">.</span><span style="color: #aaaaaa;">foreground</span> <span style="color: #5c5c5c;">=</span> <span style="color: #000000;">ncol</span><span style="color: #5c5c5c;">+(</span><span style="color: #bc8f8f;">1</span><span style="color: #ffaa00;">:</span><span style="color: #000000;"></span><span style="color: #5c5c5c;"></span><span style="color: #000000;">ncurv)</span><span style="color: #000000;">;</span> <span style="color: #64ae64; font-style: italic;">// </span><span style="color: #64ae64; font-style: italic;">"</span><span style="color: #64ae64; font-style: italic;">vectorized</span><span style="color: #64ae64; font-style: italic;">"</span><span style="color: #64ae64; font-style: italic;"> assignment allowed. for loop not required
</span>
</pre>
</div>
<div class="v1moz-cite-prefix">Hope this helps.<br />Samuel<br /><br /></div>
<div class="v1moz-cite-prefix">Le 15/11/2021 à 13:38, Izabela Wójcik-Grząba a écrit :</div>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<p>Hello,</p>
<p>I need some help with a param3d1 graph. Each polyline should have color from a colormap according to the value assigned in a T vector. Here is a simple example (not finished):</p>
<p><span style="font-family: courier new, courier, monospace;">X=[0.5 1.5 1.5 ; 1.5 2.5 1.5];</span></p>
<p><span style="font-family: courier new, courier, monospace;">Y=[0.5 1 1 ; 1 0.5 2];</span></p>
<p><span style="font-family: courier new, courier, monospace;">Z=[0 1 1 ; 1 2 3];</span></p>
<p><span style="font-family: courier new, courier, monospace;">T=[2 1 3];</span></p>
<p><span style="font-family: courier new, courier, monospace;">[sorted_T, index_sort_T]=gsort(T , 'g' , 'i');</span></p>
<p><span style="font-family: courier new, courier, monospace;">colors=zeros(size(T , 'r');</span></p>
<p><span style="font-family: courier new, courier, monospace;">colors(index_sort_T , :)=jetcolormap(size(T , 'r');</span></p>
<p><span style="font-family: courier new, courier, monospace;">param3d1(X,Y,Z);</span></p>
<p><span style="font-family: courier new, courier, monospace;">h=gca().children(1);</span></p>
<p><span style="font-family: courier new, courier, monospace;">h.children.thickness=4;</span></p>
<p><span style="font-family: courier new, courier, monospace;">for i=size(T,'r')</span></p>
<p><span style="font-family: courier new, courier, monospace;">h.children(i).color=???</span></p>
<p><span style="font-family: courier new, courier, monospace;">end</span></p>
<p>Instead of question marks there should be a color index, but I don't know how to define it using jetcolormap.</p>
<p>I would be grateful for your kind help,</p>
<div id="v1signature">-- <br />
<div class="v1pre" style="margin: 0; padding: 0; font-family: monospace;"><span style="font-family: book antiqua, palatino, serif;">Izabela Wójcik-Grząba</span><br /><span style="font-family: book antiqua, palatino, serif;">Zespół Konstrukcji Metalowych</span><br /><span style="font-family: book antiqua, palatino, serif;">ZKBiM IIB WIL Politechnika Warszawska</span><br /><br /></div>
</div>
</blockquote>
</div>
</div>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br />users mailing list<br /><a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br /><a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank" rel="noopener noreferrer">http://lists.scilab.org/mailman/listinfo/users</a></div>
</blockquote>
</body></html>