Many of us have to write reports or make presentations with visualizations. The challenge sometimes isn’t the underlying data or the visualization itself, but the corporate design. In my case, the corporate design of the organization is based on an excel template for diagrams, with all its disadvantages. My goal is to automate most of it with plotly and convince my academic organization to move to plotly to a certain extent. I simply love plotly and its capabilities!
Therefore I would like to share things I couldn’t find elsewhere and others also might search for in future. Or simply raise questions
Is there a suitable workaround for my very special case “tickvall_standoff” (only the x-axis)?
For the cooperate design I need to have a “tickvall_standoff”. Unfortunately something like this doesn’t exist. So I played a bit and came to the following solution:
Unfortunately, in the cooperate design setup is a pixel missing because of the white tickline on the x-axis (see figure 2 a) ). Does someone have a better solution? Everything else I tried failed… well, and since bosses can be quite picky… “problems”
Any help is highly appreciated!
df = px.data.iris() fig = px.scatter(df, x="sepal_length", y="petal_length", color='sepal_width') fig.add_shape( # Rectangle with reference to the plot type="rect", xref="paper", yref="paper", x0=0, y0=0, x1=1.0, y1=1.0, line=dict( color="black", width=1, ) ) fig.update_xaxes(showline=True, linewidth=2.5, linecolor='black', gridcolor='black', gridwidth=1, zeroline=True, zerolinewidth=1.5, zerolinecolor='black', ticks = "outside", tickcolor='white', ticklen=7, tickwidth = 0.1,) # A work-arround for "tickval_standoff" (because it doesn't exist) fig.update_yaxes(showline=True, linewidth=2.5, linecolor='black', gridcolor='black', gridwidth=1, zeroline=True, zerolinewidth=1.5, zerolinecolor='black', ticksuffix = 3 * ' ' # A work-arround for "tickval_standoff" (because it doesn't exist) ) fig.show(renderer = 'pdf')