by Guest » 22 Feb 2025, 15:19
Ich denke, ich bin total verloren, wenn es um Plotly Express , Plotly_Figure_Factory usw. . Nebenhandlungen wie hier detailliert. Alles zusammenstellen Ich habe < /p>
Code: Select all
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import plotly.graph_objects as go
rawData = [
{'journalist':75,'developer':25,'designer':0,'label':'point 1'},
{'journalist':70,'developer':10,'designer':20,'label':'point 2'},
{'journalist':75,'developer':20,'designer':5,'label':'point 3'},
{'journalist':5,'developer':60,'designer':35,'label':'point 4'},
{'journalist':10,'developer':80,'designer':10,'label':'point 5'},
{'journalist':10,'developer':90,'designer':0,'label':'point 6'},
{'journalist':20,'developer':70,'designer':10,'label':'point 7'},
{'journalist':10,'developer':20,'designer':70,'label':'point 8'},
{'journalist':15,'developer':5,'designer':80,'label':'point 9'},
{'journalist':10,'developer':10,'designer':80,'label':'point 10'},
{'journalist':20,'developer':10,'designer':70,'label':'point 11'},
];
def makeAxis(title, tickangle):
return {
'title': {'text': title, 'font': { 'size': 20}},
'tickangle': tickangle,
'tickfont': { 'size': 15 },
'tickcolor': 'rgba(0,0,0,0)',
'ticklen': 5,
'showline': True,
'showgrid': True
}
fig = go.Figure(go.Scatterternary({
'mode': 'markers',
'a': [i for i in map(lambda x: x['journalist'], rawData)],
'b': [i for i in map(lambda x: x['developer'], rawData)],
'c': [i for i in map(lambda x: x['designer'], rawData)],
'text': [i for i in map(lambda x: x['label'], rawData)],
'marker': {
'symbol': 100,
'color': '#DB7365',
'size': 14,
'line': { 'width': 2 }
}
}))
fig.update_layout({
'ternary': {
'sum': 100,
'aaxis': makeAxis('Journalist', 0),
'baxis': makeAxis('
Developer', 45),
'caxis': makeAxis('
Designer', -45)
},
'annotations': [{
'showarrow': False,
'text': 'Simple Ternary Plot with Markers',
'x': 0.5,
'y': 1.3,
'font': { 'size': 15 }
}]
})
fig.show()
my_ternary_plot = go.Scatterternary({
'mode': 'markers',
'a': [i for i in map(lambda x: x['journalist'], rawData)],
'b': [i for i in map(lambda x: x['developer'], rawData)],
'c': [i for i in map(lambda x: x['designer'], rawData)],
'text': [i for i in map(lambda x: x['label'], rawData)],
'marker': {
'symbol': 100,
'color': '#DB7365',
'size': 14,
'line': { 'width': 2 }
}})
figure = make_subplots(rows=1, cols=2)
figure.add_trace(my_ternary_plot,
row=1, col=1
)
figure.add_trace(
my_ternary_plot,
row=1, col=2
)
figure.update_layout(height=600, width=800, title_text="Side By Side Subplots")
figure.show()
< /code>
, aber ich erhalte den Fehler < /p>
valueError: Trace -Typ 'Scatterary' ist nicht mit dem Subplot -Typ 'xy' kompatibel.
In der Gitterposition (1, 1) < /p>
Siehe DOCString für das Spezifikationsargument an plotly.subplots.make_subplots
Weitere Informationen zu Unterhandtypen
Darüber hinaus können ich Referenzen darauf finden Expressdiagramme, z. ein Objekt wie dieses < /p>
Code: Select all
data_rand = pd.DataFrame(data=np.random.uniform(0,1,size=((20,4))), columns = ["a","b", "c", "d"])
data_rand["size"] = 35
import plotly.graph_objects as go
import plotly.express as px
plot_ter = px.scatter_ternary(data_rand, a="a", b = "b", c="c",
color="d", size="size")
fig.show()
Ich möchte Nebenhandlungen haben, nicht nur mit Plotly.express -diagramme, die auch andere Matplotlib -Plots enthalten, nirgendwo einen Hinweis finden. Gibt es keine einfache Möglichkeit zu übergeben. Ich kenne AX -Objekte nicht zu Matplotlib Abbildungen?
Vielen Dank
Ich denke, ich bin total verloren, wenn es um Plotly Express , Plotly_Figure_Factory usw. . Nebenhandlungen wie hier detailliert. Alles zusammenstellen Ich habe < /p>
[code]import plotly.graph_objects as go
from plotly.subplots import make_subplots
import plotly.graph_objects as go
rawData = [
{'journalist':75,'developer':25,'designer':0,'label':'point 1'},
{'journalist':70,'developer':10,'designer':20,'label':'point 2'},
{'journalist':75,'developer':20,'designer':5,'label':'point 3'},
{'journalist':5,'developer':60,'designer':35,'label':'point 4'},
{'journalist':10,'developer':80,'designer':10,'label':'point 5'},
{'journalist':10,'developer':90,'designer':0,'label':'point 6'},
{'journalist':20,'developer':70,'designer':10,'label':'point 7'},
{'journalist':10,'developer':20,'designer':70,'label':'point 8'},
{'journalist':15,'developer':5,'designer':80,'label':'point 9'},
{'journalist':10,'developer':10,'designer':80,'label':'point 10'},
{'journalist':20,'developer':10,'designer':70,'label':'point 11'},
];
def makeAxis(title, tickangle):
return {
'title': {'text': title, 'font': { 'size': 20}},
'tickangle': tickangle,
'tickfont': { 'size': 15 },
'tickcolor': 'rgba(0,0,0,0)',
'ticklen': 5,
'showline': True,
'showgrid': True
}
fig = go.Figure(go.Scatterternary({
'mode': 'markers',
'a': [i for i in map(lambda x: x['journalist'], rawData)],
'b': [i for i in map(lambda x: x['developer'], rawData)],
'c': [i for i in map(lambda x: x['designer'], rawData)],
'text': [i for i in map(lambda x: x['label'], rawData)],
'marker': {
'symbol': 100,
'color': '#DB7365',
'size': 14,
'line': { 'width': 2 }
}
}))
fig.update_layout({
'ternary': {
'sum': 100,
'aaxis': makeAxis('Journalist', 0),
'baxis': makeAxis('
Developer', 45),
'caxis': makeAxis('
Designer', -45)
},
'annotations': [{
'showarrow': False,
'text': 'Simple Ternary Plot with Markers',
'x': 0.5,
'y': 1.3,
'font': { 'size': 15 }
}]
})
fig.show()
my_ternary_plot = go.Scatterternary({
'mode': 'markers',
'a': [i for i in map(lambda x: x['journalist'], rawData)],
'b': [i for i in map(lambda x: x['developer'], rawData)],
'c': [i for i in map(lambda x: x['designer'], rawData)],
'text': [i for i in map(lambda x: x['label'], rawData)],
'marker': {
'symbol': 100,
'color': '#DB7365',
'size': 14,
'line': { 'width': 2 }
}})
figure = make_subplots(rows=1, cols=2)
figure.add_trace(my_ternary_plot,
row=1, col=1
)
figure.add_trace(
my_ternary_plot,
row=1, col=2
)
figure.update_layout(height=600, width=800, title_text="Side By Side Subplots")
figure.show()
< /code>
, aber ich erhalte den Fehler < /p>
valueError: Trace -Typ 'Scatterary' ist nicht mit dem Subplot -Typ 'xy' kompatibel.
In der Gitterposition (1, 1) < /p>
Siehe DOCString für das Spezifikationsargument an plotly.subplots.make_subplots [/code] Weitere Informationen zu Unterhandtypen
Darüber hinaus können ich Referenzen darauf finden Expressdiagramme, z. ein Objekt wie dieses < /p>
[code]data_rand = pd.DataFrame(data=np.random.uniform(0,1,size=((20,4))), columns = ["a","b", "c", "d"])
data_rand["size"] = 35
import plotly.graph_objects as go
import plotly.express as px
plot_ter = px.scatter_ternary(data_rand, a="a", b = "b", c="c",
color="d", size="size")
fig.show()
[/code]
Ich möchte Nebenhandlungen haben, nicht nur mit Plotly.express -diagramme, die auch andere Matplotlib -Plots enthalten, nirgendwo einen Hinweis finden. Gibt es keine einfache Möglichkeit zu übergeben. Ich kenne AX -Objekte nicht zu Matplotlib Abbildungen?
Vielen Dank