Python - xyz раскраски графикPython

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Python - xyz раскраски график

Сообщение Anonymous »

Текущий это мой код для оси XY: < /p>

Код: Выделить всё

import numpy as np
import matplotlib.pyplot as plt

def plot_with_tricontourf_customized(dfs, figures_organizer, figsize_setting, list_points_mean, list_points_type, x_col, y_col, color_col, titles, marker_type='o', apply_limits=False, x_limits=None, y_limits=None):
rows, cols = figures_organizer
fig, axes = plt.subplots(rows, cols, figsize=(figsize_setting[0], figsize_setting[1] * rows), constrained_layout=True)
axes = axes.flatten()  # Flatten the axes array for easier indexing

for i, (ax, df, title, points_mean, points_type) in enumerate(zip(axes, dfs, titles, list_points_mean, list_points_type)):
x = df[x_col].to_numpy()
y = df[y_col].to_numpy()
group = df[color_col].to_numpy()

# Use a color map directly
cmap = plt.colormaps['bwr']

scatter = ax.scatter(x, y, c=group, cmap=cmap, edgecolor='black', marker=marker_type, s=40, alpha=0.8)
contour = ax.tricontourf(x, y, group, levels=np.arange(-0.5, df[color_col].max() + 1.5), zorder=0, cmap=cmap, alpha=0.3)

# Plot fixed points with specific markers
for point, type in zip(points_mean, points_type):
ax.scatter([point[0]], [point[1]], color='black', marker=type, s=100)

# Add dashed lines passing through fixed points
for point in points_mean:
ax.axvline(x=point[0], color='black', linestyle='--')
ax.axhline(y=point[1], color='black', linestyle='--')

ax.set_xlabel(x_col)
ax.set_ylabel(y_col)
ax.set_title(title)
ax.grid(True)

if apply_limits:
if x_limits:
ax.set_xlim(x_limits)
if y_limits:
ax.set_ylim(y_limits)

legend1 = ax.legend(*scatter.legend_elements(), loc="upper right", title=color_col)
ax.add_artist(legend1)

# Add a text box for fixed points explanation
textstr = "★ : y=1 mean\n♦ : y=0 mean"
props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
ax.text(0.05, 0.95, textstr, transform=ax.transAxes, fontsize=12,
verticalalignment='top', bbox=props)

# Hide any unused axes if there are more subplots than dataframes
for ax in axes[len(dfs):]:
ax.axis('off')

plt.colorbar(scatter, ax=axes[:len(dfs)], orientation='horizontal', fraction=0.02, pad=0.04, ticks=np.arange(df[color_col].min(), df[color_col].max() + 1))
plt.show()

# Example usage
# Suppose you have 15 dataframes, their means, types, and titles ready in lists
# plot_with_tricontourf_customized(dfs, (4, 4), list_points_mean, list_points_type, 'x', 'y', 'group', titles)
Пример вывода:

Теперь я хочу настроить на 3D с xyz axis и keric на громкость. Похоже на мой показанный вывод, но теперь в 3d. < /P>
Я ищу: < /p>

Нарисуйте это на 3D, как мне настроить код < /li>
, чтобы настроить представление 3d < /li>
< /ul>
>

Подробнее здесь: https://stackoverflow.com/questions/795 ... ter-region
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Почему мой код раскраски графика неправильно раскрашивает график?
    Гость » » в форуме C++
    0 Ответы
    20 Просмотры
    Последнее сообщение Гость
  • Как разрезать 2D-линейный график, чтобы создать 3D-график поверхности (или контурный график)? Питон
    Anonymous » » в форуме Python
    0 Ответы
    73 Просмотры
    Последнее сообщение Anonymous
  • Как найти все возможные раскраски в задаче о восьми ферзях?
    Anonymous » » в форуме C#
    0 Ответы
    8 Просмотры
    Последнее сообщение Anonymous
  • Как найти все возможные раскраски в восьми проблем с королевой?
    Anonymous » » в форуме C#
    0 Ответы
    14 Просмотры
    Последнее сообщение Anonymous
  • Как я могу осмотреть точные раскраски CSS по умолчанию для браузера?
    Anonymous » » в форуме Html
    0 Ответы
    20 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Python»