Data Visualization with Pandas and Plotly
Data Visualization: Theory and Practice
What a visualization does
A data visualization communicates a message through a visual form. It is not limited to charts made with software: any visual feature that helps people interpret information can serve a similar purpose.
For example, marble steps in the Leaning Tower of Pisa develop visible wear marks where people have walked most often. Those marks communicate a pattern of foot traffic. The steps can therefore be understood as an informal visualization: the physical wear encodes information about where people walked.
That observation can be translated into a more conventional chart:
The horizontal axis represents position across the width of a step.
The vertical axis represents the amount of wear at each position.
A line traces the observed wear pattern.
A reference line can distinguish areas with no visible wear from areas showing wear.
A short explanatory message states the interpretation, such as where foot traffic was concentrated.
This example illustrates that a visualization involves more than displaying data. It encodes information visually and helps an audience understand what that information means.
The purpose of business visualization
In a business setting, a visualization should help stakeholders make a decision or take action. Its goal is not simply to look attractive or demonstrate technical sophistication.
A business visualization is successful when it helps its audience understand what matters and decide what to do.
A useful test is to ask whether the visualization supports a decision or encourages a relevant action. If it does neither, it may not be serving its business purpose.
The two parts of an effective visualization
Effective visualization combines science and art:
Science: The accurate mapping of quantitative information to visual features, such as position, length, size, and color.
Art: The choices that shape the presentation and story, including what to emphasize, how to explain it, and what to leave out.
Neither part is sufficient by itself. A technically accurate chart may not communicate a useful message, while a persuasive presentation may mislead if its visual encoding is unclear or inaccurate.
The science: mapping data to visual dimensions
A visual dimension is a feature of a display that can represent information. Common dimensions include position, length, size, color, and separation between marks. A chart can represent one or several data dimensions by assigning each dimension to a visual feature.
One data dimension
A single number can be represented by the length of a bar. For instance, a value of 55 is mapped to a bar of corresponding length.
The chart’s reader can then compare the bar’s length with other bars or with a scale. The data value is represented through one visual dimension: length.
Two data dimensions
A chart can represent more than one dimension at once. For example:
Bar length can represent a numerical value.
Vertical position can distinguish separate data points.
In this arrangement, the reader uses length to compare magnitudes and position to tell the data points apart. Each visual dimension has a distinct role.
Three data dimensions
A scatter plot can represent three quantitative dimensions:
The horizontal position represents one variable, such as revenue.
The vertical position represents another, such as profit.
The size of each marker represents a third, such as market capitalization.
A reader can then compare companies by their positions and marker sizes. A size legend or other reference can help explain how marker size corresponds to the underlying values.
Representing many dimensions
Some charts encode many kinds of information at once. A weather chart, for example, might show:
Temperature along a vertical axis
Precipitation or rainfall
Months of the year
Individual days
Highs, lows, and ranges through color
Special records or annotations through callouts
Using many dimensions can communicate a great deal in a compact space, but it also increases the effort required to interpret the display. The chart must make each encoding clear, and the information should support a coherent message.
The art: shaping the message
Analysts have substantial flexibility in how they present the same data. A chart is not merely a neutral container: choices about scale, emphasis, labels, and included details influence what an audience notices.
This flexibility creates a responsibility. The analyst should decide what the audience needs to understand and use visual choices to support that understanding.
Choosing an axis scale
Consider a set of conversion rates near 4%. The same data could be shown with different vertical-axis ranges:
A narrow range, such as 3.9% to 4.5%, makes small changes appear more dramatic.
A range from 0% to 100% places the values in the context of a possible full-scale conversion rate.
A range from 0% to 4.5% emphasizes how far the observed values are above zero.
There is no universally correct scale independent of the question and message. The appropriate scale depends on what the audience needs to see. A narrow scale may be useful for examining small changes; a broader scale may better convey the values’ size in context.
Scale choices can strongly affect the narrative, so they should be deliberate and transparent. Minimum and maximum values can help orient the reader, but they do not always have to be shown. If extreme values are far outside the range relevant to the analysis, an analyst may sometimes exclude them—but only when that decision is justified and clearly communicated.
Avoiding excessive visual complexity
A chart can become overloaded when it contains more groups, subgroups, colors, or other visual features than the audience can readily interpret.
Before including a visual feature, the analyst should ask:
Does it support the message?
Does it help the audience answer the question?
Would removing it make the important pattern clearer?
A detail should not be included merely because the chart can display it. Unnecessary complexity can obscure the message and make the chart harder to use.
Avoiding redundant visual dimensions
Redundant visual dimensions encode the same information more than once. For example:
An area chart may use vertical position to show magnitude and also change color according to that same magnitude.
A bar chart may show a value through bar length and repeat the same information through a color gradient.
Redundancy can make a chart look more elaborate without adding useful information. It may also confuse readers, who may wonder whether the different encodings represent different variables. Visual dimensions are most useful when each one contributes distinct information or serves a clearly explained purpose.
Start with the question and audience
A visualization project should begin by clarifying what the audience needs to know. In business analysis, that often means understanding the stakeholder’s goal before selecting a chart or beginning implementation.
Useful questions include:
What are the stakeholder’s priorities?
What problem or pain point are they addressing?
What decision or action should the analysis support?
What is the goal for the company, department, or project?
Does the requested question actually help answer that goal?
A stakeholder may ask for an analysis that does not directly address their underlying objective. The analyst can help clarify the problem and redirect the work before time is spent creating a visualization that answers the wrong question.
The chart type should also follow the analytical goal. Starting with the intended takeaway can help determine whether the data are best presented as a line chart, bar chart, scatter plot, table, or another form.
A practical workflow for building a business chart
A useful visualization workflow begins with the intended message and then prepares and displays the data in service of that message.
1. Define the message
For a chart about profitable companies, a possible stakeholder question is: which industries are most common among the most profitable companies?
The goal is to make the answer clear in both the chart’s visual elements and its written explanation. The chart should emphasize relevant evidence, avoid redundant encoding, and omit details that do not help answer the question.
2. Inspect and prepare the data
A company dataset may contain many columns, while the chart needs only a subset, such as:
Company name
Revenue
Profit
Industry sector
Market capitalization
Preparing the data can include selecting relevant columns, renaming fields for clarity, and checking the number of records. In a Pandas workflow, column selection and renaming help create a simpler dataset for charting.
Sorting companies by profit can also reveal which sectors appear among the most profitable companies. This analysis should happen before the conclusion is presented; the chart should reflect the findings rather than substitute for examining the data.
3. Choose visual encodings
A scatter plot can address the question using several dimensions:
Horizontal position represents company revenue.
Vertical position represents company profit.
Marker size represents market capitalization.
Marker color distinguishes whether a company belongs to a selected industry group, such as finance or technology.
Each encoding should have a defined meaning. In this example, color helps the audience distinguish the industries relevant to the stakeholder’s question, while size adds information about company scale.
4. Refine the chart for interpretation
Several additions can make a chart easier to understand:
Set the chart dimensions so it is readable and not unnecessarily large.
Use a legend or category order that makes the categories easy to interpret.
Add useful hover details, such as company names, when the plotting tool supports interaction.
Use audience-friendly labels, replacing technical field names with clear descriptions.
Add a title that states the main takeaway.
Use annotations to draw attention to an important group or pattern.
A chart title can function as a concise summary. If the title states the intended conclusion, it should still be supported by the chart’s evidence rather than treated as a replacement for it.
5. Annotate important findings
A highlighted region can draw attention to a subset of the data, but it needs an explanation. A rectangle around points, for example, may prompt the reader to ask why those points matter.
An annotation can provide the missing context by naming the pattern, such as the concentration of highly profitable companies in particular industries. Lines, shapes, and text can therefore work together: the shape directs attention, and the text explains what the audience should notice.
Annotations should be legible and concise. Line breaks or careful positioning can help prevent annotation text from stretching across the chart or obscuring data.
6. Match the presentation to the audience
A chart made in Python or another coding environment is not necessarily the best format for presenting to stakeholders. Stakeholders often need the data and the story, not the code used to produce them.
An analyst can create a chart with a library such as Plotly and then place it in a presentation or document. The choice of tool should support both the analysis and the way the audience will consume the results.
Visualization tools and interactivity
The most suitable visualization tool depends on the task and the practitioner’s needs. Possible tools include spreadsheets, Python libraries, R, Tableau, Power BI, and other dashboard or reporting platforms.
Choosing a tool
Tool choice should not distract from the central work of analysis and communication. A useful tool is one that allows the analyst to produce and share a clear, appropriate visualization without unnecessary difficulty.
Different tools offer different balances between ease of use and flexibility. A highly flexible library may allow extensive customization but require more effort to learn. A more structured tool may be easier to use but constrain certain design choices. The practical choice depends on the desired result and the user’s familiarity with the tool.
Interactive charts
Interactive features can let viewers explore a chart through actions such as hovering over points, filtering categories, or adjusting ranges and scales. Plotly, for example, can provide hover details and other interactive controls.
Interactivity is useful when it helps an audience investigate the data. It does not replace a clear explanation of the main finding. A chart intended for others to explore may also need to be hosted or shared in a format that allows them to access its interactive features.
Data labels
If every point needs a visible label, labels can be added through a plotting library’s built-in options or through annotations. In a dense chart, labeling every point may create clutter. One alternative is to label only the most important points, such as the companies that form the main focus of the analysis.
Bias, scales, and analytical judgment
Visual choices influence interpretation. A selected scale can make a change appear more or less prominent, and a chart’s chosen question can direct attention toward one aspect of the data rather than another.
This influence is not inherently improper. In business analysis, an analyst is expected to interpret data and communicate what matters. The key is to ensure that the question is relevant, the chart’s choices are appropriate to the message, and the visualization does not create a misleading impression.
A responsible process includes:
Clarifying the stakeholder’s underlying goal before making the chart.
Choosing a scale that suits the question and gives readers useful context.
Explaining exclusions, such as removing extreme values, when they affect interpretation.
Using labels, titles, and annotations to make the intended reading clear.
Ensuring the conclusion is supported by the data.
In settings where the audience does not trust the analyst to interpret the data, stakeholders may prefer raw data or control over the chart’s scale. The appropriate approach depends partly on the relationship between the analyst and the audience, but clarity and defensible choices remain important.
Building data-analysis skills
Developing as a data analyst involves more than learning a charting library. Four broad skill areas support strong analysis:
Storytelling and visualization: Turning results into a clear message and presenting them effectively.
Business strategy and context: Understanding organizational goals and identifying what data can help advance them.
Data handling and engineering: Working with datasets, programming, and database structures.
Statistical analysis: Applying suitable quantitative methods to understand and evaluate data.
A background in software development or engineering can provide useful technical experience, especially for engineering-focused work, but it is not a requirement for entering data analysis. People can develop programming and analytical skills through study and practice. Likewise, familiarity with spreadsheets can provide a useful foundation: experience with rows and columns, formulas, conditionals, and combining calculations can make the move to Python more approachable.
Communication skill also develops through practice. Experience presenting, feedback from mentors, and learning from unsuccessful attempts can all help someone become more effective at explaining analysis to stakeholders.
Key principles
Begin with the decision or action the visualization should support.
Clarify the stakeholder’s real goal before choosing a question or chart.
Map each data variable to a clear visual feature such as position, length, size, or color.
Use scale deliberately, because it affects how patterns and changes appear.
Keep only visual features that support the message, and avoid unnecessary complexity.
Avoid redundant encodings that repeat information without helping the audience.
Use titles, labels, legends, and annotations to make the chart understandable outside the analyst’s explanation.
Choose tools based on the task and audience, while keeping analysis and communication—not software choice—at the center.

Ask anything
We've read this whole study set, so questions about it get the best answers.