Important traek will make your charts available to people with visual injuries

About 4,5% of the world's population.
Millions of all over the world have one kind of visual damage. Numbers are too high if you take all the conditions into an account. However, it is the most widely discussed topic.
As a data specialist, you do not want the person you want to translate. Certainly, more clarity is a lot of work, but you will make a good episode of people more happy.
Today you will get 5 practical advice to make your existing view.
Control guidelines for using your data view view
But first, let's go over regular guidelines that you should follow when access is very important.
All listed below is the selected and short test of A11y project. If you wonder, “A11y” is a summary of “Availability” (11 characters between “a” and “Y”).
However, here is what you should pay attention to:
- Do not rely on color to describe information – Honorable Chunk of people is a blind man or otherwise suffering from visual disabilities. Patterns are a way to travel.
- If you use color, go with dark, different tones – Light and bottom colors make it difficult to distinguish between groups of chartically.
- Do not hide important data after working – Hover events are only available on desktop. Most of your users are in smartphones.
- Use labels and myths – Without them, the learner does not know what information represents.
- Translate data on clear view – Easy as much as as possible, and then others. You don't want anything to be open to interpret.
- Provide the context and explain the observation – If possible, enter data score points, and add below writing / interface.
- Have users with a reader's readers in mind – People with visual damage to use the screen students navigate Web pages. Use Alt text to describe your senters.
With these in mind, I came with an active 5 tweaks you can do to seeing you now.
Please log in to # 1.
1. Use a big difference or friendly color palette
The easiest way to understand why news of choosing the color can do the wrong thing first.
Consider the following data:
x = np.array(["New York", "San Francisco", "Los Angeles", "Chicago", "Miami"])
y1 = np.array([50, 63, 40, 68, 35])
y2 = np.array([77, 85, 62, 89, 58])
y3 = np.array([50, 35, 79, 43, 67])
y4 = np.array([59, 62, 33, 77, 72])
You are the full election of the stack chart. In other words, to show office places in X-axis and a numbered work in Y-axis.
Now think that you're colored in color.
You may want to color in each of the bars in different green fields. It is a terrible practice (without a specific monochomatic color), as you can see the following:
plt.bar(x, y1, label="HR", color="#32a852")
plt.bar(x, y2, bottom=y1, label="Engineering", color="#3ebd61")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing", color="#2bc254")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales", color="#44c767")
plt.title("[DON'T] Employee Count Per Location And Department", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.show()
Many people wonder how their chart would look like when it is printed in a black and white book.
This one will only look bad, but only because you look beautiful in the go. Separating between parts of the bar is challenging even to humans without visual damage.
You can use this website to check the difference between two colors.
Let's fix using a different color palette.
A custom palette in a customary
I will continue with the thought you love green color.
Question: How to build a different color palette from one color?
Answer: Start with a black shadow and finish with color that is sufficiently in your main color. In this case, Yellow-Gold is a perfect man.
You get the best of the world in this way. You still use your favorite colors and colors don't have to be simple (potentially lower) as you pass in parts of the bar.
In operation, this calls down to play around color
The parameter of all parts:
plt.bar(x, y1, label="HR", color="#14342B")
plt.bar(x, y2, bottom=y1, label="Engineering", color="#60935D")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing", color="#BAB700")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales", color="#F5E400")
plt.title("[DO] Employee Count Per Location And Department", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.show()

It is very easy in the eyes.
Predefind Color Palette
But think of the following situations:
- You don't have time to play with different color meetings
- You have time, but there are about twelve categories in your Database (Read: twelve colors to find)
There is a simple solution to make your Chat ChatracClow Color system easier in the eyes when it is counted by people with disabilities.
One such solution is to use the Colournblind-Friendly Color Palette.
The first Snippet line shows you how:
plt.style.use("tableau-colorblind10")
plt.bar(x, y1, label="HR")
plt.bar(x, y2, bottom=y1, label="Engineering")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales")
plt.title("[DO] Employee Count Per Location And Department", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.show()

This palette contains 10 color-friendly colors – 10, so ready for charts with 10 groups or less.
If you need more, you'll get better and reconsider your view strategy.
2. Stop using colors – use patterns instead of
Another good way to remove any kind of misinterpretation from your charts to use patterns instead of colors (or as for color).
Mattplotlib has 10 hatch pattern options.
You can further hatches by increasing their power or by combining multiple patterns. But that topic sometimes.
Using patterns, add hatch
parameter to plt.bar()
. The below example is completely eliminated by setup fill=False
:
plt.bar(x, y1, label="HR", fill=False, hatch="*")
plt.bar(x, y2, bottom=y1, label="Engineering", fill=False, hatch="xx")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing", fill=False, hatch="..")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales", fill=False, hatch="//")
plt.title("[DO] Employee Count Per Location And Department", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.show()

Now there is no way to misinterpret data on the chart.
Can you mix patterns in color?
If you want the best of the world, the color + of the pattern there.
You will want to remove filling = false parameter and change it with color
. Or, just copy the following snippet:
plt.bar(x, y1, label="HR", color="#14342B", hatch="*")
plt.bar(x, y2, bottom=y1, label="Engineering", color="#60935D", hatch="xx")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing", color="#BAB700", hatch="..")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales", color="#F5E400", hatch="//")
plt.title("[DO] Employee Count Per Location And Department", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.show()

Black patterns are best seen in parts of bar, but that may not be.
This page edgecolor
The parameter controls the color of the pattern. Let's see what happens after putting them in white:
plt.bar(x, y1, label="HR", color="#14342B", hatch="*", edgecolor="#FFFFFF")
plt.bar(x, y2, bottom=y1, label="Engineering", color="#60935D", hatch="xx", edgecolor="#FFFFFF")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing", color="#BAB700", hatch="..", edgecolor="#FFFFFF")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales", color="#F5E400", hatch="///", edgecolor="#FFFFFF")
plt.title("[MAYBE] Employee Count Per Location And Department", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.show()

The pattern is visible Hr including Engineering Doors, but the two more is a different matter.
You may have a problem with seeing the lines in the frontal line, but place them in a man's shoes with a disability. Should always be your reference frame.
Remember: Light colored patterns work well in black domains. Black colored patterns work well in bright domains. Change rightly.
3. Do not overlook the user with information
This principle moves in two ways:
- Don't add more information on one chart
- Do not place too many charts next to each other, eg, in your apps / Dashboard applications
To do everything in some way somehow The greatest sin in data recognition.
Let us first add a few brothers to mix.
Details are difficult to manage Python List, so I have selected Pandas Danda Abfame instead:
import pandas as pd
df = pd.DataFrame({
"HR": [50, 63, 40, 68, 35],
"Engineering": [77, 85, 62, 89, 58],
"Marketing": [50, 35, 79, 43, 67],
"Sales": [59, 62, 33, 77, 72],
"Customer Service": [31, 34, 61, 70, 39],
"Distribution": [35, 21, 66, 90, 31],
"Logistics": [50, 54, 13, 71, 32],
"Production": [22, 51, 54, 28, 40],
"Maintenance": [50, 32, 61, 69, 50],
"Quality Control": [20, 21, 88, 89, 39]
}, index=["New York", "San Francisco", "Los Angeles", "Chicago", "Miami"])
df

Now, using the Colorblind-Friendly Palette, let's set up worker's accounting with the site and the door as a jail chart. Making Things More, I also Call the Text Century on MIX:
plt.style.use("tableau-colorblind10")
ax = df.plot(kind="bar", stacked=True)
for container in ax.containers:
ax.bar_label(container, label_type="center", fontsize=10, color="#000000", fontweight="bold")
plt.title("[DON'T] Employee Count Per Location And Department", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(title="Department", bbox_to_anchor=(1.05, 1), loc='upper left', ncol=1)
plt.show()

Now that is just bad.
Adjust # 1 – Less information available
Another way to solve the missing locked refinements indicate the lowest information to the user.
For example, only show the calculation of employees in one town (in all departments). You can add a Menu drop on the chart's side so the user controls office.
The following Snippet employees are assisted individually employees in Chicago as a horizontal chart:
chicago_data = df.loc["Chicago"].sort_values()
bars = plt.barh(chicago_data.index, chicago_data.values, color="#60935D", edgecolor="#000000")
for bar in bars:
plt.text(bar.get_width() + 2, bar.get_y() + bar.get_height() / 2, f"{int(bar.get_width())}", va="center", ha="left", fontsize=14, color="#000000")
plt.title("[DO] Employee Count by Department in Chicago", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Count")
plt.ylabel("Department")
plt.show()

Fix # 2 – Reset data
If it shows less information is not an option, maybe you can do Forward your data.
For example, we deal with 5 office places and 10 departments. Displays 10 columns instead of 10 components of bars easy in the eyes.
In this way, you will end up showing office locations as parts of the bar instead of the departments:
df_transposed = df.T
df_sorted = df_transposed.loc[df_transposed.sum(axis=1).sort_values().index]
ax = df_sorted.plot(kind="barh", width=0.8, edgecolor="#000000", stacked=True)
for container in ax.containers:
ax.bar_label(container, label_type="center", fontsize=10, color="#FFFFFF", fontweight="bold")
plt.title("[DO] Employee Count Per Location And Department", loc="left", fontdict={"weight": "bold"}, y=1.06)
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.show()

It's just a matter of awakening a problem.
Open chart Picture 10 miles before the chart Picture 8. Is true. No one can argue with it.
4. Provide deep definitions of data on your charts
You can find the profit below and / or parts of your chart to add additional information.
This comes help when you want to give you more context about the data, cite sources, or summarize your view points. Lastly applies to people with visual injuries.
The problem with matplotlib is what does not have a committed activity By the submarines and the loans. You can use Suptitle (), but you will need to play around with X and Y-Ask links.
Here is an example:
plt.bar(x, y1, label="HR", color="#14342B", hatch="*")
plt.bar(x, y2, bottom=y1, label="Engineering", color="#60935D", hatch="xx")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing", color="#BAB700", hatch="..")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales", color="#F5E400", hatch="//")
plt.suptitle("Chart shows how the employees are distributed per department and per office location.nChicago office has the most employees.", x=0.125, y=0.98, ha="left", fontsize=14, fontstyle="italic")
plt.title("Employee Count Per Location And Department", fontsize=20, fontweight="bold", y=1.15, loc="left")
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.show()

If you choose a glimpse over the subhead, you have a change of axis connecting to plt.suptitle()
:
plt.bar(x, y1, label="HR", color="#14342B", hatch="*")
plt.bar(x, y2, bottom=y1, label="Engineering", color="#60935D", hatch="xx")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing", color="#BAB700", hatch="..")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales", color="#F5E400", hatch="//")
plt.suptitle("Chart shows how the employees are distributed per department and per office location.nChicago office has the most employees.", x=0.125, y=0, ha="left", fontsize=14, fontstyle="italic")
plt.title("Employee Count Per Location And Department", fontsize=20, fontweight="bold", y=1.06, loc="left")
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.show()

Everything in everything, targets or glitter can be a decisive thing in finding your message to a person with a physical disability.
Just don't do 10 categories long. Besides, the third point of this article and.
5. Enter Alt text when embarking up
Many people with disabilities use the screen students.
The problem with screen students and charts that they will not only be able to meet. They may be able to select text items on the graph, but they cannot translate the visual content. So, whenever you share your eyes (eg. You hold on the website), you should add ALT text.
This is the classroom class to read your user.
To show, let's use plt.savefig()
The job of last chart as a picture:
plt.bar(x, y1, label="HR", color="#14342B", hatch="*")
plt.bar(x, y2, bottom=y1, label="Engineering", color="#60935D", hatch="xx")
plt.bar(x, y3, bottom=y1 + y2, label="Marketing", color="#BAB700", hatch="..")
plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales", color="#F5E400", hatch="//")
plt.suptitle("Chart shows how the employees are distributed per department and per office location.nChicago office has the most employees.", x=0.125, y=0, ha="left", fontsize=14, fontstyle="italic")
plt.title("Employee Count Per Location And Department", fontsize=20, fontweight='bold', y=1.06, loc="left")
plt.xlabel("Office Location")
plt.ylabel("Count")
plt.legend(loc="upper right", ncol=4)
plt.ylim(top=320)
plt.savefig("figure.jpg", dpi=300, bbox_inches="tight")
To a new HTML text, add an
A photo pointing to a picture. This is where you have to give an ALT text:
Document

You can't see Alt text when you open the HTML file, but that's because you don't use a screen reader.
If a screen reader, ALT text will be automatically read to the user.
The best you can do is using the plugin to read the screen or point to an invoice that is not in HTML:


Now the picture cannot be detected, so the Alt text has been shown instead.
Summarizing access to the idea of availability
And when you have – 5 things to keep you remember when planning data observation.
These advice is usually helpful but very important when access is important. And it should be. It requires a little bit of work from your end, but it makes the findings found in millions of more people around the world.