使用matplot做图--sin图像
# _*_ coding:utf-8 _*_
import numpy as np
import matplotlib.pyplot as plt x = np.arange(-5, 5, 0.1)
y = np.sin(x)
plt.plot(x, y)
plt.show()
这里插入一个可能会碰到的问题:
I am trying to import matplotlib like so: import matplotlib.pyplot as plt
For this I have installed matplotlib using. python -m pip install -U pip setuptools
python -m pip install matplotlib
Although the basic_example.py from the examples worked, it suddenly stopped running along with all other files with matplotlib giving me the below error: File "matplotlib.py", line 2, in <module>
import matplotlib.pyplot as plt # pyplot module.
ImportError: No module named pyplot`
I tried to check if the module is still there, and it seems to be. What could be possibly wrong? Requirement already satisfied: matplotlib in c:\python27\lib\site-packages
Requirement already satisfied: numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: python-dateutil in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: cycler in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,>=1.5.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: pytz in c:\python27\lib\site-packages (from matplotlib)
Requirement already satisfied: six>=1.5 in c:\python27\lib\site-packages (from python-dateuti
简单的说就是,安装了模块,但是出现模块导入错误。
看看回答:
Python 2.7 tries to find modules in the current working directory first, before
going into the installed packages, so because you named your test file "matplotlib.py",
it will interpret it as the matplotlib package. Rename your test file to something else, and it should be fine
是的,检查一下你的文件名是不是跟导入的模块名重复了。。。。
使用matplot做图--sin图像的更多相关文章
- 从视频文件中读入数据-->将数据转换为灰度图-->对图像做canny边缘检测-->将这三个结构显示在一个图像中
//从视频文件中读入数据-->将数据转换为灰度图-->对图像做canny边缘检测-->将这三个结构显示在一个图像中 //作者:sandy //时间:2015-10-10 #inclu ...
- 图像切割—基于图的图像切割(Graph-Based Image Segmentation)
图像切割-基于图的图像切割(Graph-Based Image Segmentation) Reference: Efficient Graph-Based Image Segmentation ...
- QiniuUpload- 一个方便用七牛做图床然后插入markdown的小工具
最近一段时间有用markdown做笔记,其他都好,但是markdown插入图片挺麻烦的,特别是想截图之后直接插入的时候.需要首先把图片保存了,然后还要上传到一个地方生成链接才能插入.如果有个工具可以直 ...
- python做图笔记
1. 工具选择 了解了基本python,rodeo,anaconda套件这三种工具. (1)基本python,下载安装python的最新版(目前是python3.7).注意要使用安装版.安装好后,一般 ...
- win10 uwp 使用 asp dotnet core 做图床服务器客户端
原文 win10 uwp 使用 asp dotnet core 做图床服务器客户端 本文告诉大家如何在 UWP 做客户端和 asp dotnet core 做服务器端来做一个图床工具 服务器端 从 ...
- matplotlib 做图通过弹出窗口展示 spyder
tools =>preferences=>Ipython console=>Graphics Graphics backend 中Backend 由Inline改为 Automati ...
- 用 GraphScope 像 NetworkX 一样做图分析
NetworkX 是 Python 上最常用的图分析包,GraphScoep 兼容 NetworkX 接口.本文中我们将分享如何用 GraphScope 像 NetworkX 一样在(大)图上进行分析 ...
- 跟我学Python图像处理丨基于灰度三维图的图像顶帽运算和黑帽运算
摘要:本篇文章结合灰度三维图像讲解图像顶帽运算和图像黑猫运算,通过Python调用OpenCV函数实现. 本文分享自华为云社区<[Python图像处理] 十三.基于灰度三维图的图像顶帽运算和黑帽 ...
- 矢量做图组件OTGisX的使用(类似Mapbase)
一:组件添加到工具栏 要在应用程序中应用OTGisX控件,首先要把所下载的OTGisX组件添加到.Net工程中.并将其添加到工具箱托盘中.添加方式为:在工具箱上单击右键,选择“选择项”,会出现“选择工 ...
随机推荐
- 【DB2】db2常用SQL语句集合
持续更新中 1.修改日志模式为不记录 alter table table_name activate not logged initially; 2.清空表 alter table t1 activ ...
- wordpress调用函数大全
WordPress模板基本文件 style.css 样式表文件 index.php 主页文件 single.php 日志单页文件 page.php 页面文件 archvie.php 分类和日期存档页文 ...
- 数据挖掘之权重计算(PageRank)
刘 勇 Email:lyssym@sina.com 简介 鉴于在Web抓取服务和文本挖掘之句子向量中对权重值的计算需要,本文基于MapReduce计算模型实现了PageRank算法.为验证本文算法 ...
- OpenWrt的开机启动服务(init scripts)
参考 https://wiki.openwrt.org/doc/techref/initscripts 以一个简单的例子来说明 #!/bin/sh /etc/rc.common # Example s ...
- [SpriteKit] 制作瓦片地图小游戏
概述 SpriteKit制作瓦片地图游戏,深入了解2D游戏制作过程 详细 代码下载:http://www.demodashi.com/demo/10703.html 说实话这个2D游戏实战的入门看的我 ...
- 微信小程序开发思路
小程序还没有完全开放,不能真实体验,但通过文档和开发工具,可以了解到他的开发思路 下面就介绍下小程序的开发方式,希望能帮助有兴趣的朋友对整体思路有个快速了解 整体结构 默认示例项目的目录结构 从后缀名 ...
- js getAttribute getAttributeNode
getAttribute():返回属性值,是一个文本字符串 getAttributeNode("属性名"):返回属性节点,是一个对象 <p id="bj" ...
- deque容器的运用一点一点积累
#include<iostream> #include<deque> #include<cstdio> #include<cstring> #inclu ...
- 【LeetCode】18. 4Sum (2 solutions)
4Sum Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d ...
- java socket输入输出中文乱码问题
http://hi.baidu.com/linjk03/item/e2028bfd990c14ea1a111feb 统一了输入输出的编码格式,是不会有乱码问题出现的. 构造Reader或Write ...