Workaround of "tickvall_standoff" fails!? | styling a figure | corporate design

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 :slight_smile:

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” :upside_down_face:

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')

1 Like

I think we probably will need to implement ticklabelstandoff or something to really crack this. I can’t think of a reliable workaround that won’t occasionally lead to artifacts like that one pixel

1 Like

Hello, I’m having the same problem, I’d like to know if there is an API to change the ticklabelstandoff, thanks a lot!

Hi @o.O you have the exact same problem concerning the pixel?

Or do you need the ticklable line to start with a certain offset with respect to the axis?

Concerning the pixel: a tickcolor='rgb(0 ,0, 0, 0)' instead of tickcolor='white' should do the trick.

EDIT: reading your post again, it is clear that you are asking for the offset, sorry for that.

1 Like

First of all, thank you for the answer!

Unfortunately I don’t understand how coloring the tick ‘black’ does the trick…

grafik

Hi!

I am sorry, I forgot the “a” rgba(0,0,0,0)

How sweet! Tha alpha channel of rgba is definitely doing the job! Thank you so much!

1 Like

Thanks again!

1 Like