Update app.py
Browse files
app.py
CHANGED
@@ -148,4 +148,44 @@ ax.set_ylabel('y2')
|
|
148 |
# Display the PDF plot in Streamlit using Matplotlib
|
149 |
st.pyplot(fig_2d)
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
#st.pyplot(fig)
|
|
|
148 |
# Display the PDF plot in Streamlit using Matplotlib
|
149 |
st.pyplot(fig_2d)
|
150 |
|
151 |
+
# Create a 2D contour plot for PDF using Matplotlib
|
152 |
+
fig_2d, ax = plt.subplots()
|
153 |
+
cp = ax.contourf(y1, y2, cdf_values, cmap='viridis')
|
154 |
+
fig_2d.colorbar(cp)
|
155 |
+
ax.set_title('BCNOLLN CDF 2D Contour Plot')
|
156 |
+
ax.set_xlabel('y1')
|
157 |
+
ax.set_ylabel('y2')
|
158 |
+
|
159 |
+
# Display the PDF plot in Streamlit using Matplotlib
|
160 |
+
st.pyplot(fig_2d)
|
161 |
+
|
162 |
+
# Create a Plotly figure for the 2D contour plot
|
163 |
+
fig_2d_plotly = go.Figure(data=
|
164 |
+
go.Contour(
|
165 |
+
z=cdf_values,
|
166 |
+
x=y1, # Corresponds to Y1's axis values
|
167 |
+
y=y2, # Corresponds to Y2's axis values
|
168 |
+
colorscale='Viridis',
|
169 |
+
contours=dict(
|
170 |
+
coloring ='heatmap', # Use 'heatmap' for a filled contour plot
|
171 |
+
showlabels = True, # Show labels on contours
|
172 |
+
labelfont = dict( # Label font properties
|
173 |
+
size = 12,
|
174 |
+
color = 'white',
|
175 |
+
),
|
176 |
+
)
|
177 |
+
)
|
178 |
+
)
|
179 |
+
|
180 |
+
# Update layout of the figure
|
181 |
+
fig_2d_plotly.update_layout(
|
182 |
+
title='BCNOLLN CDF 2D Contour Plot',
|
183 |
+
xaxis_title='y1',
|
184 |
+
yaxis_title='y2',
|
185 |
+
autosize=True,
|
186 |
+
)
|
187 |
+
|
188 |
+
# Display the plot in Streamlit
|
189 |
+
st.plotly_chart(fig_2d_plotly)
|
190 |
+
|
191 |
#st.pyplot(fig)
|