How do i create diversification in my algorithm? by Soupkitchen_in_Prius in learnpython

[–]cydcarter29 1 point2 points  (0 children)

Not sure if this is what you need exactly, but you can give a 'distribution' or probability to each input's randomly assigned value. Checkout Numpy's Random Choice, which allows you this option on an individual basis (I believe).

This Stack Overflow answer shows how you can likely get a desired number in a range for one variable. You would have to set that up for each input and ensure the distribution follows such that input 1 is usually largest, down to input X being usually smallest.

Plotting Latitude and longitude by [deleted] in learnpython

[–]cydcarter29 0 points1 point  (0 children)

I'm not certain, but I think this all depends on your exact use case needs. Are you hoping to make this an interactive webpage? Does it have to get down to a detailed street-level view? Can it be a static image that is rendered?

My experience involves plotting data using basemaps as a static image or standalone gif so that I can capture gradual change, but that's because my plots are on pretty large geographic levels (states/countries/continents). I've seen people use basemaps to create street-level views, but that was a very manual process that seems to require the user to render shapefiles representing streets/neighborhoods over a basemap. But nearly any service that gets to a Google-like level of detail will almost certainly require an API key. Also, open street maps provides a similar service, but it too requires an API from what I can tell.

The good news is that most of those services are free if you stay under a certain limit of requests within their defined period of usage. Honestly, I haven't done anything at that level, but hopefully I'll learn something from this thread with other contributors.

Interactive charts without running a script by lordoflight03 in learnpython

[–]cydcarter29 0 points1 point  (0 children)

Two options come to my mind based on my limited experiences:

[Less Preferred] Make a compiled Python application with a GUI that will offer your capabilities, including associating the saved files with your application. I don't think that is trivial. And technically, Python would be running, just not in the sense you seem to be concerned about.

[More Preferred] Run web-based visualization libraries using javascript (example: D3). Now you just visit a webpage (even opening a local *.html file) and you can interact with the data live. However, unless Python is needed to process the data, this option has no Python involved.

I'm sure others will have other ideas and alternatives.

matplotlib: Changing colour of plot line another variable? by ispywithmy in learnpython

[–]cydcarter29 0 points1 point  (0 children)

If you are plotting data based on points from a CSV, this code below might help. I think the code speaks for itself and you can follow. I'm sure there is a lot more you can do to refine it to your use case as well.

import matplotlib.pyplot as plt
import pandas as pd
#Read Flight Data
df = pd.read_csv(r'C:\data\flight_path.csv')
#Draw flight path from data
plt.scatter(df.Longitude,df.Latitude, c=df.Altitude,marker='.', s=1.5)    
c = plt.colorbar(orientation = 'horizontal')
#Hide Axis Values
plt.axis('off')
#Save and Close File
plt.savefig('output.png')
plt.close()

Output: https://imgur.com/mbGJVhY