Python Forum
How to create meshgrid with non-integer stepsize of list elements?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to create meshgrid with non-integer stepsize of list elements?
#2
Couldn't you kick it up a notch, so that all the values are integers? For example, x = np.linspace(0, a * h, h). It would require dividing by h elsewhere in your code, but it is doable.

Or you could do what your last example implies: x = [0, 0.25, 0.5, 0.75, 1.0], and then use the integers 0 through 4 for your indexes. You then translate the indexes using x.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: How to create meshgrid with non-integer stepsize of list elements? - by ichabod801 - Mar-11-2019, 02:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  unable to remove all elements from list based on a condition sg_python 3 458 Jan-27-2024, 04:03 PM
Last Post: deanhystad
Question mypy unable to analyse types of tuple elements in a list comprehension tomciodev 1 493 Oct-17-2023, 09:46 AM
Last Post: tomciodev
  Delete strings from a list to create a new only number list Dvdscot 8 1,555 May-01-2023, 09:06 PM
Last Post: deanhystad
  Checking if a string contains all or any elements of a list k1llcod3 1 1,116 Jan-29-2023, 04:34 AM
Last Post: deanhystad
  [split] why can't i create a list of numbers (ints) with random.randrange() astral_travel 7 1,530 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
  How to change the datatype of list elements? mHosseinDS86 9 2,011 Aug-24-2022, 05:26 PM
Last Post: deanhystad
  ValueError: Length mismatch: Expected axis has 8 elements, new values have 1 elements ilknurg 1 5,169 May-17-2022, 11:38 AM
Last Post: Larz60+
  how to easily create a list of already existing item CompleteNewb 15 3,576 Jan-06-2022, 12:48 AM
Last Post: CompleteNewb
  Change a list to integer so I can use IF statement buckssg 3 2,253 Sep-21-2021, 02:58 AM
Last Post: bowlofred
  Why am I getting list elements < 0 ? Mark17 8 3,170 Aug-26-2021, 09:31 AM
Last Post: naughtyCat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020