Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6779869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:26:20+00:00 2026-05-26T16:26:20+00:00

I am working on creating a contour plot using Matplotlib. I have all of

  • 0

I am working on creating a contour plot using Matplotlib. I have all of the data
in an array that is multidimensional. It is 12 long about 2000 wide. So it is
basically a list of 12 lists that are 2000 in length. I have the contour plot
working fine, but I need to smooth the data. I have read a lot of
examples. Unfortunately, I don’t have the math background to understand what is
going on with them.

So, how can I smooth this data? I have an example of what my graph looks like
and what I want it to look more like.

This is my graph:

graph illustration

What I want it to look more similar too:

my goal

What means do I have to smooth the contour plot like in second plot?


The data I am using is pulled from an XML file. But, I will show the output of
part of the array. Since each element in the array is around 2000 items long, I
will only show an excerpt.

Here is a sample:

[27.899999999999999, 27.899999999999999, 27.899999999999999, 27.899999999999999,
 28.0, 27.899999999999999, 27.899999999999999, 28.100000000000001, 28.100000000000001,
 28.100000000000001, 28.100000000000001, 28.100000000000001, 28.100000000000001,
 28.100000000000001, 28.100000000000001, 28.0, 28.100000000000001, 28.100000000000001,
 28.0, 28.100000000000001, 28.100000000000001, 28.100000000000001, 28.100000000000001,
 28.100000000000001, 28.100000000000001, 28.100000000000001, 28.100000000000001,
 28.100000000000001, 28.100000000000001, 28.100000000000001, 28.100000000000001,
 28.100000000000001, 28.100000000000001, 28.100000000000001, 28.100000000000001,
 28.100000000000001, 28.100000000000001, 28.0, 27.899999999999999, 28.0,
 27.899999999999999, 27.800000000000001, 27.899999999999999, 27.800000000000001,
 27.800000000000001, 27.800000000000001, 27.899999999999999, 27.899999999999999, 28.0,
 27.800000000000001, 27.800000000000001, 27.800000000000001, 27.899999999999999,
 27.899999999999999, 27.899999999999999, 27.899999999999999, 28.0, 28.0, 28.0, 28.0,
 28.0, 28.0, 28.0, 28.0, 27.899999999999999, 28.0, 28.0, 28.0, 28.0, 28.0,
 28.100000000000001, 28.0, 28.0, 28.100000000000001, 28.199999999999999,
 28.300000000000001, 28.300000000000001, 28.300000000000001, 28.300000000000001,
 28.300000000000001, 28.399999999999999, 28.300000000000001, 28.300000000000001,
 28.300000000000001, 28.300000000000001, 28.300000000000001, 28.300000000000001,
 28.399999999999999, 28.399999999999999, 28.399999999999999, 28.399999999999999,
 28.399999999999999, 28.300000000000001, 28.399999999999999, 28.5, 28.399999999999999,
 28.399999999999999, 28.399999999999999, 28.399999999999999]

Keep in mind this is only an excerpt. The dimension of the data is 12 rows by
1959 columns. The columns change depending on the data imported from the XML
file. I can look at the values after I use the Gaussian_filter and they do
change. But, the changes are not great enough to affect the contour plot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:26:21+00:00Added an answer on May 26, 2026 at 4:26 pm

    You could smooth your data with a gaussian_filter:

    import numpy as np
    import matplotlib.pyplot as plt
    import scipy.ndimage as ndimage
    
    X, Y = np.mgrid[-70:70, -70:70]
    Z = np.cos((X**2+Y**2)/200.)+ np.random.normal(size=X.shape)
    
    # Increase the value of sigma to increase the amount of blurring.
    # order=0 means gaussian kernel
    Z2 = ndimage.gaussian_filter(Z, sigma=1.0, order=0)
    fig=plt.figure()
    ax=fig.add_subplot(1,2,1)
    ax.imshow(Z)
    ax=fig.add_subplot(1,2,2)
    ax.imshow(Z2)
    plt.show()
    

    enter image description here

    The left-side shows the original data, the right-side after gaussian filtering.

    Much of the above code was taken from the Scipy Cookbook, which demonstrates gaussian smoothing using a hand-made gauss kernel. Since scipy comes with the same built in, I chose to use gaussian_filter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on creating an immutable class. I have marked all the properties
working on creating an XML file with some data using Python. I am trying
I'm currently working on creating a new C# project that needs to interact with
I am working on creating a daemon in Ruby using the daemons gem. I
I'm working on creating a domain layer in Zend Framework that is separate from
So I'm working on creating a visualization for a data structure in Java. I
I've been working on creating a form that submits content into my database but
I'm working on creating a date/time user control in WPF using C# 2008. My
I am working on creating a simple contest submission system using django. This is
I'm working on creating an app that will parse MSDN articles for meta-information such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.