'plotly express scatter plot python
I have a problem with plotly I want to make a scatter plot I want to make this same graph but with other circle shape for ind1, tringale for ind2 and the color is according to the type
here is my my code code for your help:
data = {'ind1':[4,8,12,13,22,23],'ind2':[1,5,9,60,90,30],'type':['reg1','reg2','reg1','reg1','reg2','reg1']}
df = pd.DataFrame(data=data)
fig = px.scatter(df, x=df['ind1'],y= df['ind2'],color='type')
fig.show()
the graph that I compe to make and like the one in my answer but instead of having the shape of point in the two indicator I want to make the difference by changing the shape of the indicator 2 in triangle and keep the color by type like c is the case in this figure
Solution 1:[1]
I don't really understand how the desired graph should look like,
but here is an example of styling symbols with plotly express
Note, that in order for this to work you need to pass a list list_of_symbols to symbol variable (in this case it is the name of the column in df containting that list) and a dictionary dict with dict.keys() = list_of_symbols, while values for desired symbols you can look up here

data = {'ind1':[4,8,12,13,22,23],'ind2':[1,5,9,60,90,30],'type':['reg1','reg2','reg1','reg1','reg2','reg1']}
df = pd.DataFrame(data=data)
fig = px.scatter(df, x='ind1', y= 'ind2', color='type',
symbol = 'ind2',
symbol_map = {1:'diamond-open-dot',
5:'diamond-open',
9:'diamond',
60:'cross-open-dot',
90:'triangle-right-open-dot',
30:'hexagon'})
fig.show()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Konstantin Z |

