Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matplotlib scale
#1
Hi everyone,


I've created a code to run a 2D mapping using matplotlib from a .csv file.
I've tried to set the maximum color (red) of the scale as 80% of the maximum value and not as the maximum value of my .csv file.
Does someone know how to modify that?
I've tried different solution but it doesn't work.

Thanks

import os import matplotlib.pyplot as plt import pandas as pd import numpy as np from matplotlib import colorbar, colors import matplotlib.tri as tri #os.chdir("C:/Users/Julien Hofmann/Desktop/Nano-indentation") data = pd.read_csv("Cartographie.csv",sep=';') nb_lignes=21 nb_colonnes=27 fig = plt.figure(figsize=(15,12)) ax = plt.subplot(1,1,1) x=np.linspace(0,(data["x"][len(data["x"])-1]-data["x"][0])*1000,nb_colonnes) y=np.linspace(0,(data["y"][len(data["y"])-1]-data["y"][0])*1000,nb_lignes) X,Y=np.meshgrid(x,y) z=np.array(data["Durete"]) triang = tri.Triangulation(data["x"], data["y"]) interpolator = tri.LinearTriInterpolator(triang, z) Xi, Yi = np.meshgrid(x, y) zi = interpolator(Xi, Yi) cntr1 = ax.contourf(x, y, z.reshape(nb_lignes,nb_colonnes), levels=150, cmap="jet") cbar = fig.colorbar(cntr1, ax=ax) ax.axis('on')
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to change a tkinter label with scale and how to save that new value for later? bkeith 3 4,450 Jun-28-2024, 01:35 AM
Last Post: deanhystad
  How to properly scale text in postscript conversion to pdf? philipbergwerf 3 2,861 Nov-07-2022, 01:30 PM
Last Post: philipbergwerf
  KeyError: 0 when trying to dedupe and match records at scale Catalytic 1 6,630 Apr-07-2022, 06:34 PM
Last Post: deanhystad
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 5,034 Mar-11-2021, 10:52 AM
Last Post: buran
  Not able to update y2 axis scale in plotly ankitawadhwa 0 2,793 Jan-27-2020, 06:44 PM
Last Post: ankitawadhwa
  Change the scale on a Matplotlib Interactive Graph khatharsis 0 4,243 Oct-13-2019, 06:14 AM
Last Post: khatharsis
  How to manually define color bar scale in seaborn heatmap SriRajesh 3 22,893 Sep-08-2019, 11:12 AM
Last Post: RudraMohan
  python decimal scale precision massimo_m 5 8,607 Aug-22-2019, 11:47 AM
Last Post: perfringo
  Extend the scale Krszt 1 3,963 Nov-05-2018, 01:16 PM
Last Post: Gribouillis
  Python Classes or Functions for large scale application ? Vithulan 5 6,501 Oct-23-2017, 04:48 PM
Last Post: Larz60+

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.