File talk:Medicaid expansion map of US. Affordable Care Act.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Request for state names or abbreviations in map[edit]

Could you make an SVG map with state names or abbreviations? Similar to this one:

Could any of the blank maps with state names or abbreviations here be used:

See also:

I left a request for help here:

--Timeshifter (talk) 00:56, 19 August 2023 (UTC)[reply]

✓ Done I lightened the colors to make the text legible. cmɢʟee ⋅τaʟκ 19:13, 19 August 2023 (UTC)[reply]
cmglee. Thanks! And I noticed it is has an editable section at the top of the SVG code similar to the template map above. Fantastic. This can be used for US maps that don't need data on the map.
Testing 350px thumbnail:
For this map the legend fits. Other maps with more than one word for each part of the legend will be a problem. It would be nice to have a template version of this map that uses a full line below the map just for the legend. It is important that the legend text is large and readable at thumbnail sizes like above. Then there is no need for complicated image captions with the legend code, etc.. And the image can be easily passed on outside Wikimedia without a caption outside the image. --Timeshifter (talk) 19:45, 19 August 2023 (UTC)[reply]
You're welcome. I adapted the template and kept useful parts. I'll leave the legend, as they say, as an exercise for the reader. The relevant code is under class="legend". Good luck, cmɢʟee ⋅τaʟκ 04:38, 20 August 2023 (UTC)[reply]

Added to user-editable maps list. More options[edit]

cmglee and others. See map linked here: Commons:Map resources#Commons. User-editable maps.

I see that I can choose the overall text color. And that it accepts colors like "black" and "white". I would like the ability to choose the text color of the state abbreviations for each state color in the legend.

I see that users can choose 2 of the state colors in the legend. But not the 3rd color. I would like to be able to choose all 3 colors.

I would like the ability to break up the map into more colors: 4 colors, 5, etc..

It looks easy to move the states around between the colors:

#im,#WA1,#OR1,#CA1,#AK1,#NV1,#ID1,#UT1,#AZ1,#MT1,#CO1,#NM1,#HI1,#ND1,#SD1,#NE1,#OK1,#MN1,#IA1,#MO1,#AR1,#LA1,#IL1,#IN1,#MI1,#IN1,#KY1,#OH1,#WV1,#VA1,#PA1,#NY1,#ME1,#VT1,#NH1,#MA1,#RI1,#CT1,#NJ1,#DE1,#MD1,#DC1 { fill:#9999ff; } /** Implemented */
#ad,#NC1 { fill:#99ccff; } /** Adopted but not implemented */

I assume the #im and #ad are for "implemented" and "adopted".

Could they be generalized to something like #c1 and #c2? Color 1, Color 2.

And could more be created, but be ignored if not used in the above list? #c3 and #c4, etc.? --Timeshifter (talk) 04:21, 23 August 2023 (UTC)[reply]

Yes, "im" and "ad" refer to the little swatch in the legend. To have more colours, just add more lines to the <style> tag e.g.
#TX1,#FL1 { fill:#ffcc00; }
It's tricky to make everything customizable as it's like reinventing Inkscape. Anyway, the legend will need to be remade for more categories. cmɢʟee ⋅τaʟκ 12:33, 23 August 2023 (UTC)[reply]

Thanks cmglee. I played around with a copy, and removed the legend code altogether. What remains is a really easy choropleth map with the possibility of many colors. A legend can be added later in the image caption below the map. With {{Legend}} and {{Div col}}

What would really be nice is something like this:

#WA1,#OR1,#CA1,#AK1,#NV1,#ID1,#UT1,#AZ1,#MT1,#CO1,#NM1,#HI1,#ND1,#SD1,#NE1,#OK1,#MN1,#IA1,#MO1,#AR1,#LA1,#IL1,#IN1,#MI1,#IN1,#KY1,#OH1,#WV1,#VA1,#PA1,#NY1,#ME1,#VT1,#NH1,#MA1,#RI1,#CT1,#NJ1,#DE1,#MD1,#DC1 { fill:#9999ff; TEXT:COLOR;} /** Category 1 */
#NC1 { fill:#99ccff; TEXT:COLOR;} /** Category 2 */
#TX1,#FL1 { fill:#ffcc00; TEXT:COLOR;} /** Category 3 */

I don't know how to do that text color in SVG code. The Category 1,2,3 is just a memory aid for making the outside legend. The legend names would replace Category 1,2,3. --Timeshifter (talk) 04:05, 24 August 2023 (UTC)[reply]

I shan't be able to make state-specific text color for the next two weeks, but if anyone wants to do it, I suggest using color:#123456 for it; <text fill="currentColor".../> can then pick up the color.
Two issues to solve are:
  1. The labels extend beyond the boundaries of the state, so if the label is drawn with the state map, the next map drawn may cover up the label. As far as I know, rsvg ignores the z-index parameter.
  2. Some labels are drawn partially outside the map, so if the state map is dark, the label might be half-legible regardless of its color. Also, if the map is dark but the label is entirely off the map e.g. those with leader lines, should the labels also be dark?
All these complications make it simpler and more consistent to make the labels black and state maps pale colors. cmɢʟee ⋅τaʟκ 08:51, 24 August 2023 (UTC)[reply]
Text are their own elements and have their own fill. To do them in CSS you go for something like
#WA1 text, #OR1 text, #CA1 text, #AK1 text, #NV1 text, #ID1 text, #UT1 text, #AZ1 text, #MT1 text, #CO1 text, #NM1 text, #HI1 text, #ND1 text, #SD1 text, #NE1 text, #OK1 text, #MN1 text, #IA1 text, #MO1 text, #AR1 text, #LA1 text, #IL1 text, #IN1 text, #MI1 text, #IN1 text, #KY1 text, #OH1 text, #WV1 text, #VA1 text, #PA1 text, #NY1 text, #ME1 text, #VT1 text, #NH1 text, #MA1 text, #RI1 text, #CT1 text, #NJ1 text, #DE1 text, #MD1 text, #DC1 text { fill: white; }
Yeah that's tedious, but that's how CSS works for now. With future CSS nesting you should be able to use
#WA1,#OR1,#CA1,#AK1,#NV1,#ID1,#UT1,#AZ1,#MT1,#CO1,#NM1,#HI1,#ND1,#SD1,#NE1,#OK1,#MN1,#IA1,#MO1,#AR1,#LA1,#IL1,#IN1,#MI1,#IN1,#KY1,#OH1,#WV1,#VA1,#PA1,#NY1,#ME1,#VT1,#NH1,#MA1,#RI1,#CT1,#NJ1,#DE1,#MD1,#DC1 { fill:#9999ff; text { fill: white; } }
but I don't think SVG-CSS has that yet. Artoria2e5 contribs 08:02, 3 September 2023 (UTC)[reply]
Oh, and the current <use>+<text> structure does not make the above CSS work either, because the text elements by themselves have NOTHING to do with the corresponding state names. The above CSS only works when the <text> is placed under the id=WA1 <def> element. Artoria2e5 contribs 08:06, 3 September 2023 (UTC)[reply]

cmglee. I used abbreviations for 8 state names. I changed class="name" to class="state". I was able to bump up the state name text size to 19px. I can't do more without having to use more state abbreviations. I moved the state names around to allow them to fit within the state lines at 19px size. Also to allow room for values too if the map is later used for that purpose. Here are the current results:

SVG code
 <use xlink:href="#AK1"/><text transform="translate(125,505)" class="state" y="-2ex">Alaska</text>
 <use xlink:href="#AL1"/><text transform="translate(645,410)" class="state" y="-2ex">AL</text>
 <use xlink:href="#AR1"/><text transform="translate(545,380)" class="state" y="-2ex">Arkansas</text>
 <use xlink:href="#AZ1"/><text transform="translate(200,380)" class="state" y="-2ex">Arizona</text>
 <use xlink:href="#CA1"/><text transform="translate( 80,325)" class="state" y="-2ex">California</text>
 <use xlink:href="#CO1"/><text transform="translate(320,290)" class="state" y="-2ex">Colorado</text>
 <use xlink:href="#CT1"/><text transform="translate(900,280)" class="state" y="-2ex">Connecticut</text>
 <use xlink:href="#DE1"/><text transform="translate(900,360)" class="state" y="-2ex">Delaware</text>
 <use xlink:href="#FL1"/><text transform="translate(750,505)" class="state" y="-2ex">FL</text>
 <use xlink:href="#GA1"/><text transform="translate(711,425)" class="state" y="-2ex">Georgia</text>
 <use xlink:href="#HI1"/><text transform="translate(280,580)" class="state" y="-2ex">Hawaii</text>
 <use xlink:href="#IA1"/><text transform="translate(520,230)" class="state" y="-2ex">Iowa</text>
 <use xlink:href="#ID1"/><text transform="translate(180,160)" class="state" y="-2ex">Idaho</text>
 <use xlink:href="#IL1"/><text transform="translate(592,262)" class="state" y="-2ex">Illinois</text>
 <use xlink:href="#IN1"/><text transform="translate(645,255)" class="state" y="-2ex">IN</text>
 <use xlink:href="#KS1"/><text transform="translate(440,310)" class="state" y="-2ex">Kansas</text>
 <use xlink:href="#KY1"/><text transform="translate(657,336)" class="state" y="-2ex">Kentucky</text>
 <use xlink:href="#LA1"/><text transform="translate(562,495)" class="state" y="-2ex">Louisiana</text>
 <use xlink:href="#MA1"/><text transform="translate(730,120)" class="state" y="-2ex">Massachusetts</text>
 <use xlink:href="#MD1"/><text transform="translate(900,400)" class="state" y="-2ex">Maryland</text>
 <use xlink:href="#ME1"/><text transform="translate(895,110)" class="state" y="-2ex">Maine</text>
 <use xlink:href="#MI1"/><text transform="translate(659,180)" class="state" y="-2ex">MI</text>
 <use xlink:href="#MN1"/><text transform="translate(510,112)" class="state" y="-2ex">Minnesota</text>
 <use xlink:href="#MO1"/><text transform="translate(538,320)" class="state" y="-2ex">Missouri</text>
 <use xlink:href="#MS1"/><text transform="translate(598,415)" class="state" y="-2ex">MS</text>
 <use xlink:href="#MT1"/><text transform="translate(280,110)" class="state" y="-2ex">Montana</text>
 <use xlink:href="#NC1"/><text transform="translate(781,350)" class="state" y="-2ex">N.Carolina</text>
 <use xlink:href="#ND1"/><text transform="translate(412,110)" class="state" y="-2ex">North&#8201;Dakota</text>
 <use xlink:href="#NE1"/><text transform="translate(425,240)" class="state" y="-2ex">Nebraska</text>
 <use xlink:href="#NH1"/><text transform="translate(730, 40)" class="state" y="-2ex">New Hampshire</text>
 <use xlink:href="#NJ1"/><text transform="translate(900,320)" class="state" y="-2ex">New Jersey</text>
 <use xlink:href="#NM1"/><text transform="translate(300,390)" class="state" y="-2ex">New Mexico</text>
 <use xlink:href="#NV1"/><text transform="translate(130,250)" class="state" y="-2ex">Nevada</text>
 <use xlink:href="#NY1"/><text transform="translate(730,160)" class="state" y="-2ex">New York</text>
 <use xlink:href="#OH1"/><text transform="translate(700,250)" class="state" y="-2ex">Ohio</text>
 <use xlink:href="#OK1"/><text transform="translate(460,375)" class="state" y="-2ex">Oklahoma</text>
 <use xlink:href="#OR1"/><text transform="translate( 90,135)" class="state" y="-2ex">Oregon</text>
 <use xlink:href="#PA1"/><text transform="translate(795,221)" class="state" y="-2ex">PA</text>
 <use xlink:href="#RI1"/><text transform="translate(900,240)" class="state" y="-4ex">Rhode<tspan
 x="0" y="-2ex">Island</tspan></text>
 <use xlink:href="#SC1"/><text transform="translate(738,385)" class="state" y="-2ex">SC</text>
 <use xlink:href="#SD1"/><text transform="translate(415,175)" class="state" y="-2ex">South&#8201;Dakota</text>
 <use xlink:href="#TN1"/><text transform="translate(637,377)" class="state" y="-2ex">Tennessee</text>
 <use xlink:href="#TX1"/><text transform="translate(430,450)" class="state" y="-2ex">Texas</text>
 <use xlink:href="#UT1"/><text transform="translate(215,275)" class="state" y="-2ex">Utah</text>
 <use xlink:href="#VA1"/><text transform="translate(783,319)" class="state" y="-2ex">Virginia</text>
 <use xlink:href="#VT1"/><text transform="translate(730, 80)" class="state" y="-2ex">Vermont</text>
 <use xlink:href="#WA1"/><text transform="translate(115, 67)" class="state" y="-2ex">Washington</text>
 <use xlink:href="#WI1"/><text transform="translate(570,170)" class="state" y="-2ex">Wisconsin</text>
 <use xlink:href="#WV1"/><text transform="translate(740,290)" class="state" y="-2ex">WV</text>
 <use xlink:href="#WY1"/><text transform="translate(295,200)" class="state" y="-2ex">Wyoming</text>
 <use xlink:href="#DC1"/><text transform="translate(900,440)" class="state" y="-2ex">D.C.</text>

I don't understand the text color coding. --Timeshifter (talk) 08:49, 31 August 2023 (UTC)[reply]

I just added an id to all the texts so they can be selected with #OHt { color: white }. I also changed the color to be a bit more like the original -- don't worry, I fed it through the color vision deficiency emulator and it's still readable. Artoria2e5 contribs 08:41, 3 September 2023 (UTC)[reply]

Artoria2e5. Thanks for all your work! I am figuring out what you are doing and saying. The highlighting in Notepad++ is helpful to me in this.

<!-- State background colors indicated by state abbreviation plus 1. -->
<!-- #im is legend swatch color for "Implemented" states. -->
#im,#WA1,#OR1,#CA1,#AK1,#NV1,#ID1,#UT1,#AZ1,#MT1,#CO1,#NM1,#HI1,#ND1,#SD1,#NE1,#OK1,#MN1,#IA1,#MO1,#AR1,#LA1,#IL1,#IN1,#MI1,#IN1,#KY1,#OH1,#WV1,#VA1,#PA1,#NY1,#ME1,#VT1,#NH1,#MA1,#RI1,#CT1,#NJ1,#DE1,#MD1,#DC1 { fill:#2b83ba; } /** Implemented */
<!-- #ad is legend swatch color for "Adopted but not implemented" states. -->
#ad,#NC1 { fill:#89CC7F; } /** Adopted but not implemented */
<!-- State text colors indicated by state abbreviation plus t. -->
#WAt,#ORt,#CAt,#AKt,#NVt,#IDt,#UTt,#AZt,#MTt,#COt,#NMt,#HIt,#NDt,#SDt,#NEt,#OKt,#MNt,#IAt,#MOt,#ARt,#LAt,#ILt,#INt,#MIt,#INt,#KYt,#OHt,#WVt,#VAt,#PAt,#MEt { fill: white; }
<!-- All other states have a black text. -->

--Timeshifter (talk) 11:14, 3 September 2023 (UTC)[reply]

Border color in the user-editable section. State names within borders[edit]

cmglee, Artoria2e5, Svenskbygderna, and others who are interested. Would it be possible to put the border color in the user editable section of the SVG code? I think a white border would be better. The source map using only 2-letter state abbreviations had white borders, and the borders are easily visible:

I like Liberation Sans Narrow for the state text names. I like the hyphenation too. Because I would like state names or abbreviations to fit within the borders in order to make this a multi-purpose map template. See:

So West Virginia would need to be WV. South Carolina would need the "S" above "Carolina". Michigan needs to be moved up a little. Pennsylvania may need to be hyphenated. Can lower font size to 18 px if necessary. --Timeshifter (talk) 13:29, 9 September 2023 (UTC)[reply]

Set border color to white with path {stroke: white;}. Glrx (talk) 21:04, 9 September 2023 (UTC)[reply]
Thanks Glrx. And I see that it is in the user-editable section of the SVG code. I tested it with another color, and it works for changing the color of the borders. --Timeshifter (talk) 21:09, 9 September 2023 (UTC)[reply]

File:No-excuse postal voting map of the US.png[edit]

This map could use the ACA map as a template. It is out of date.

It is posted here:

Table section there looks up to date.

Latest references I could find so far:

This map is up to date:

The 8 states with all-mail voting are listed here:

Detailed info in link below. Choose state from sidebar menu for detailed info:

More info:

--Timeshifter (talk) 19:40, 11 September 2023 (UTC)[reply]

Border color needs to be separate from leader line color[edit]

cmglee, Artoria2e5, Svenskbygderna, Glrx, and others who are interested. Currently, the border color determines the leader line color.

They need to be separated. There is no compromise color that works well. Red was the best color I could come up with in my latest upload here.

It may be easier to forego leader lines altogether, and use swatches as is done here:

--Timeshifter (talk) 21:01, 11 September 2023 (UTC)[reply]

 
purple #c0d
 
red #e00
 
green #085
 
blue #46f
 
gray #777
I respectfully disagree that swatches are superior to leader lines. Unless one is familiar with US geography, one cannot tell from the diagram which states with swatches are where.
The leader lines can be quite easily be made a different color from the borders. Re "There is no compromise color that works well", this is due to insistence of having both dark and light state backgrounds, which also then requires the labels to be of different colours (worse when long labels extend beyond the state into an inversely colored state). If we keep the backgrounds pastel, the leader lines, borders and text can all be dark. I found these colors to be distinguishable by people with deuteranomaly and deuteranopia, and exceed the recommended WCAG contrast ratio of 4.5 against black.
Cheers,
cmɢʟee ⋅τaʟκ 23:49, 11 September 2023 (UTC)[reply]
cmglee. I hadn't thought through the swatches versus leader lines idea. I am American, but I don't live in New England, and I frequently confuse New England states.
Please see: File:No-excuse postal voting map of the US.svg
I used it to replace the out-of-date map at en:Postal voting in the United States.
I was able to put the background colors where they wouldn't interfere with black leader lines. The state names fit within their borders.
I notated the user-editable section extensively. I changed the swatch ids to aa and bb.
I alphabetized the lists of state abbreviations in the user-editable sections. Makes it much easier to use the map as a template.
It would be nice if the swatches code could be moved to the user-editable section. I tried without success. Or I only succeeded on my PC and its browsers. But once uploaded the legends disappeared from the bottom of the map. See file history.
cmglee, Artoria2e5, Svenskbygderna, Glrx, and others. Is it possible to make a state's borders the same color as the state's name? Or at least the internal borders. The dark blue section needs white borders.
And/Or can the color of the leader lines within the map be the same color as the state's name? The leader lines would be black outside the map.
Then I could select the best border color for the map as a whole. White works well. But right now the border color is the same as the leader line color. Selecting border colors for each section of the map would be even better.
Dashed multi-color border lines might help too.
Can the swatches be moved to the left a little? So there is more room for legend text per line. --Timeshifter (talk) 01:49, 12 September 2023 (UTC)[reply]
I added class="leader" to the leader line path element and set the stroke color to black. Glrx (talk) 01:51, 12 September 2023 (UTC)[reply]
Glrx. Thanks! That is better. Is it possible to make the leader lines white once they cross into the map? --Timeshifter (talk) 03:27, 12 September 2023 (UTC)[reply]

Class for "Not adopted" states[edit]

Can a class be added for the "Not adopted" states? Am I right in assuming that would make switching the colors and states around easier? --Timeshifter (talk) 19:26, 17 September 2023 (UTC)[reply]

Color blindness tools. SVG file checkers[edit]

Thanks to whoever recommended it. I tried this out: http://hclwizard.org:3000/cvdemulator It is great for color blindness. Simplest tool for this that I have seen. Started these sections:

--Timeshifter (talk) 19:26, 17 September 2023 (UTC)[reply]

Getting white text to show up depends on background color order in SVG code[edit]

Glrx, cmglee, Artoria2e5, Svenskbygderna, and others. To fix the problem of white text not showing up in File:ACA Medicaid expansion.svg I had to change over to the background color order in the SVG code here:

This fixed the problem. Baffles me as to why it works. Would like to know why. Here is the map now:

Can the SVG code be made so that the background color order doesn't matter as concerns white text for selected states?

I made the borders thicker to make them more visible. I removed opacity from the leader lines. That made them darker and more visible. Legend has been moved to the left so there is more room for text. Important if map is used as a template for other maps.

It would be nice if all the swatches color, and legend text, could be moved to the user-editable section of the SVG code. --Timeshifter (talk) 19:34, 17 September 2023 (UTC)[reply]