I have a contour graph with the x axis text showing on the top. I am trying to move it to the bottom of the chart as in any normal scatter plot. I tried “position:0” and “position:1” as shown in https://plotly.com/python/reference/layout/xaxis/ but to no avail.
Anyone knows what else I could try?
Code:
import pandas as pd
import plotly.graph_objects as go
import numpy as nump
# variables are initialised with x,y co-ordinates
cordof_x = nump.arange(0, 10, 0.2)
cordof_y = nump.arange(0, 10, 0.2)
# Colourscale
colorscale = [[0, '#FFC0CB'], [0.5, 'rgb(120,120,120)'], [1, '#0000FF']]
# A mesh is created with the given co-ordinates by this numpy function
[X, Y] = nump.meshgrid(cordof_x, cordof_y)
contour_function = nump.cos((X + 6) * (1 / 10)) + nump.sin((Y) * (-1 / 10))
contour_trace = go.Contour(x=cordof_x, y=cordof_y, z=contour_function, showscale=False, ncontours=40, colorscale=colorscale, hoverinfo='skip')
scatter_trace = go.Scatter(x=[8], y=[5], mode='markers', marker=dict(symbol='star-diamond-dot', color="#FFBF00", size=24, line=dict(color="black", width=3)))
contour_plot = go.Figure(data=[contour_trace, scatter_trace])
contour_plot.update_layout({
"showlegend": False, "height":300, "width":300,
"xaxis": {"title_text": "CategoryA", 'title_font': {"size": 22, "color": "black"}, "showticklabels": False, "dtick": 1, "range": [0, 10], "position":0},
"yaxis": {"title_text": "CategoryB", 'title_font': {"size": 22, "color": "black"}, "showticklabels": False, "dtick": 1, "range": [0, 10]},
"autosize": True, "plot_bgcolor": "rgba(0, 0, 0, 0)", "paper_bgcolor": "white", "margin": dict(l=0, r=0, b=0, t=0)})
contour_plot.show()