Hi,
I made some automatic Python stacked labels but I am just looking at how to justify "Center" these labels. I cannot find the 'center' button in all the tabs! Any guess?
Thanks
hmmm don't make maps much and label less, but let's see how pythonic Pro is in that regard
label <SPAN class="operator token">=</SPAN> <SPAN class="string token">"hello"</SPAN> frmt <SPAN class="operator token">=</SPAN> <SPAN class="string token">"{!s:^15}\n{!s:^15}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>label<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Vincent"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>frmt<SPAN class="punctuation token">)</SPAN> hello Vincent <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
So it 'label' were your field, then you just need the stuff to the right of the = sign
Tried it! But not luck. Nothing happened on the map.
looks like an html designator for bold and italics... perhaps that is what you need for the labeling.
The formatting I send would require a 'print' which I guess labelling doesn't do..
But bookmark https://docs.python.org/3.6/library/string.html for working with strings in python 3.. it is a whole new world
Tried to encapsulate the print statment but no luck. Stacked labels are not justified "Center"
It did not produced an error though!
found it Text Formatting tags
not there
but if this doesn't work...
a <SPAN class="operator token">=</SPAN> <SPAN class="string token">'hello'</SPAN> a<SPAN class="punctuation token">.</SPAN>center<SPAN class="punctuation token">(</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">" "</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="string token">' hello '</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
but desperate times
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">lbl</SPAN><SPAN class="punctuation token">(</SPAN>a<SPAN class="punctuation token">,</SPAN> pad<SPAN class="operator token">=</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"""attempt to center"""</SPAN> sp <SPAN class="operator token">=</SPAN> <SPAN class="string token">" "</SPAN> sides <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN>pad <SPAN class="operator token">-</SPAN> len<SPAN class="punctuation token">(</SPAN>str<SPAN class="punctuation token">(</SPAN>a<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">//</SPAN><SPAN class="number token">2</SPAN> out <SPAN class="operator token">=</SPAN> sp<SPAN class="operator token">*</SPAN>sides <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>a<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> sp<SPAN class="operator token">*</SPAN>sides <SPAN class="keyword token">return</SPAN> out lbl<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'hello'</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="string token">' hello '</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
strangely bumped in June?
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.