How to write a Minimal Reproducible Example (MRE)

Adding a minimal reproducible example to your questions will help attract community members to answer your question. The goal of writing a MRE is to allow other members of the community to run the code on their computers and “reproduce” the error, so that they can best help you.
Please make sure that your MRE includes data and that the code is correctly pre-formatted.
To preformat, copy and paste the code in your post and then click on </> (Preformatted text), as shown on the image:

Here’s a good MRE example:

I noticed on my Dash DataTables, that headers for the table suddenly stopped respecting the style_header ‘text-align’: ‘center’ instruction when running under Dash v2.1.0. After debugging, I backed down to Dash v2.0.0 and it resolved the issue. Can you please help me understand why this is happening?

import dash
from dash import dash_table
import pandas as pd


app = dash.Dash(
    __name__
)

app.layout = dash_table.DataTable(
    columns=[
        {"name": ["", "Year"], "id": "year"},
        {"name": ["City", "Montreal"], "id": "montreal"},
        {"name": ["City", "Toronto"], "id": "toronto"},
        {"name": ["City", "Ottawa"], "id": "ottawa"},
        {"name": ["City", "Vancouver"], "id": "vancouver"},
        {"name": ["Climate", "Temperature"], "id": "temp"},
        {"name": ["Climate", "Humidity"], "id": "humidity"},
    ],
    data=[
        {
            "year": i,
            "montreal": i * 10,
            "toronto": i * 100,
            "ottawa": i * -1,
            "vancouver": i * -10,
            "temp": i * -100,
            "humidity": i * 5,
        }
        for i in range(10)
    ],
    style_header={
            'text-align': 'center',
        },
    merge_duplicate_headers=True,
)

if __name__ == '__main__':
    app.run_server(debug=True)

As you can see from the Minimal Reproducible Example (MRE) above, we built our data inside the code. However, you can also use built-in data that plotly express provides for other MREs you might write. Here are all the plotly datasets.

For example, if you’d like to use the election dataset for your post, you can access it like this:

import plotly.express as px
df = px.data.election()
print(df.head())

Please do let us know if you have further doubts about how to write a Minimal Reproducible Example :slight_smile:

Happy coding!

8 Likes
CSS for Markdown only
Markdown choose which styling
Fig.write_image not waiting for map to render completely
Grouped Slider BarHistogram
Cannot use html subclass (e.g.: html.Div) with debug mode on
How can I use variable from another page in dash web application
Datatable Multipage not showing up
Ag grid row change dynamically
Multiple Input and Output
Dropdown - how to hide selected value and only display the arrow button
Gunicorn >10x slower
How to update the rangebreaks of a date x axis so that it shows 9:30 am to 4:pm only?
Px.scatter_mapbox update: hover right, but points wrong
How to retain the uploaded data when switching between pages
My Dash plotly app not working
Datatable overflowing onto multiple pages
Returning a container to the dashboard with colored text
Draw a line between data points of different subplots
Problems showing different scattermapbox in Dash
AWS elasticbeanstalk deployment of dash app getting stuck loading
Loading and Spinners
How to change properties on particular image through update_layout_images
Gridline is not aligning with box plot
Set initial activated navlink
Customized hovertemplate on plotly parcats fig
Page forever loading
Editable table copy paste problem
How to add scatter plots to single animation frames of imshow
Chain Multiselectable Cascading Dropdowns
Weird Scatter behaviour, multiple curves drawn from one set of data
Dash-Bio: NglViewer multiple representations with multiple objects
Filter numeric datatable column by negative number does not work
Dash AG-grid filter between tables
Running my app on a localhost
How do I get rid of space in my figures in Dash?
Page unresponsive when trying to open an accordion
dcc.Dropdown pause before filtering 'options' with callback
Map updated by dropdown - First callback working but not second one - close to give up :(
Running my app on a localhost
Attempting to connect a callback Input item but no component with that ID exists
Plotly does not loading map most of the time
dcc.Graph's staticPlot keyword argument not getting recognized
Can I ask a zoom/drag issue of column chart
Passing data in multi-tab app
Overlay Scatter plot over a table
Graph resizes (arbitrarily) when changing between Tabs in a Dash App
Callback error with dropdown and hoverdata
Ag grid sorting functionality in parent header
Legend color does not match graph color
Infinitesimal width of Bar in Plotly graph objects
Call back isn't triggering?
Dash_bio JSME callbacks
Need Help to understand more deeply plotly; Scatter Color Input
Python Annotation Image Example
Is there a way to clear a dropdown from a callback?
How to change column size of closed column groups after rowData is updated?
Segmentation Fault When Importing plotly
JavaScript error while navigating through the application
Data Selection from AG Grid Column
Unable to render bar graph or pie chart on a callback
Dash-update-component doesn't work well is there Flask problem or Dash issue?
ExtendData with Go figure gauge not updating value
Python library called dash draggable cannot use pattern-matching-callback
Change Font Color for Dropdowns
Enabling tabs to hold its state with button clicks
Dash Tooltip to Scattermapbox giving wrong labels
Loading spinner for graph without an "Input"
External filter in Dash not working
Toolbar Weird Formatting
I need help displaying complete table
Multiple Boxplots with corresponding Line Charts (using subplots)
Some plot properties ignored when used as traces/subplots
Dash Heatmap colors based on Hover values
How to remove background lines (zerolines, gridlines) in Barpolar Plot?
Dash_clientside.set_props 50 times slower than document.getElementById(id).innerText
Customize pie chart text labels - value and percentage
Change card layout upon hovering
How to clear and stop a callback?
Zmid issue with coloraxis in go.Heatmap subplots
Cannot read properties of undefined
How to print colored text in an html file?
Boxplot with time xaxis plotting y as categorical
Values of Dcc.upload is not retained when I switch between the tabs
Callbacks receive initial Null or NaN values and proper use of `PreventUpdate()` calls
Dash only use half screen in my tablet
Difficulties setting annotation position accurately
dcc.Loading not working
Sort value based on month number instead of month name
Serve_layout does not reload date on multipage app
Download large csv file
Does DataTable editable=True property updates the Dictionary on which it is based?
Undo or redo on Graph
Mouse interactivity within subplots (resize - reorder)
Update Data Points Using a clientside callback
Bar chart shrink to a line when there is only one bar
Need help with connecting ag grid to graph
Mapbox figure doesnt update properly
Callbacks and Output issues encountered
Problem to refresh/redraw Graph | Cytoscape
AttributeError: 'NoneType' object has no attribute 'layout'
Trying to create seperate color value-bar for each subplot
How to update information for a single point for each rolling window
Datepickerrange Not update graph with multiple lines
Get Cellid in dash-vtk picker callback
Plotly express scatter_3d keeps changing text size
The plot from librosa doesn't appear together
How to subplot heatmap with side bar in right position?
I want to return multiple graphs but getting only single graph as output
serverSide rowModelType in Dash AgGrid
How to transfer some data with dcc.store from port A to port B
Getting 2D coordinate of mouse click on 3D mesh
Using a loop to create charts , shows the charts but not all data
Change output size of Alignment Chart (or save as svg ideally)
Stacked Area Chart with HoverInfo over filled area?
How to merge background file with the callback uploaded file
How to enable a feature where upon clicking on any row displays a modal with more information about the row.?
Sync multiple dropdowns but still be able to filter based on previous selection
Is it possible to get flask variable in dash js script?
From layout to cardbody
Dash AG Grid table in a Dash AG Grid table with custom component
Serializable Error
How can we add a ray arround a mark in a scatter during a animate frame ? In Dash
Force show text on Nan Heatmap cells
Return Empty Space
Plotly.io.to_json() in clientside callback
Dash AG Grid Custom Datepicker component Does not stop edit correctly
Overlayed histograms with no fill color
Dash-ag-grid -- Chart API: Create range chart with data that is not in a column?
Can I have a `clientside_callback` depend on an input that "maybe" not exist on the page yet?
Dash Ag Grid first row TranslateY massive
Using go.Surface in Dash
Replace mapbox figure colors?
Ag grid : Field in JavaScript
How to show all data on graph
Unwanted tab persistence
Get 3D coordinates of point in watertight mesh
Is it possible to drag and drop elements into a Dash DataTable?
Unwanted dialog box
How to Change Plotly Express bar colors using the Partial Property Update Patch()
Wrong logic of Intinite row model
AG Grid Master Detail row pinning
Dash Ag Grid cellRendererSelector can not trigger cellRendererData callback
Ag-grid custom aggregation function written in Python
Dash ag grid master detail side bar
Inter-pages callback in MultiPage App
agSelectCellEditor scrollbar problem
Persistence of Input Box on a Multi-Page App
Clientside callback to add trace in figure
How to load offline .csv data in the html
DashBio Alignment Chart/Sequence Viewer
Help: Failed to execute query selector on element
How to embed a LinkedIn profile badge? (And, using attributes from external script)

Hey @davi

This is a super helpful post - thanks for writing it up!

I also like that you used a “real world” example. This was the MRE from @geneblandjr excellent post which lead to a bug getting fixed in latest Dash release V2.2.0 :confetti_ball:

3 Likes

Sometimes, attaching screenshots can also make the problem description clearer.

3 Likes