axis

python scatter plot area size proportional axis length

拟墨画扇 提交于 2019-12-02 11:30:14
问题 I'm getting quite desperate about this, I couldn't find anything on the www so far. Here's the situation: I am working with Python. I have 3 arrays: the x-coordinates, the y-coordinates and the radius. I want to create a scatter plot with the given x- and y-coordinates. So far, everything works how I want it to. Here is what's bothering me: The circle size of each point in the scatter plot should be defined by the radius array. The the values of the coordinates and the radius are in same

Axis 1.4 log4j-1.2.8.jar incompatible with XPages?

烂漫一生 提交于 2019-12-02 09:25:30
I'm trying to add some of the JARs from Apache Axis 1.4 into the WebContent/WEB-INF/lib directory. One of the JARs is log4j-1.2.8.jar . As soon as this JAR is added to the lib directory, all XPages in the NSF stop working. I just get an error 500 with the following message: "HTTP Web Server: Command Not Handled Exception". The following message is written to the error log: java.lang.RuntimeException: com.ibm.xsp.FacesExceptionEx: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException . . . . Caused by: java.lang.NoClassDefFoundError: org/apache/log4j

How to show categorical data on x-axis when using bar function?

放肆的年华 提交于 2019-12-02 09:20:38
问题 I am trying to simulate a code which is on the official MATLAB website, but I cannot get the same output. This is the code: c = categorical({'apples','oranges','pears'}); prices = [1.23 0.99 2.3]; bar(c,prices) This is the correct output which is on the MATLAB website: This is the output that I get in my MATLAB: The c array, which is apple , orange and pears is not showing in my MATLAB output. Why don't I get the same output? My MATLAB version is R2016a. 回答1: You can try the following

pandas模块

浪子不回头ぞ 提交于 2019-12-02 08:46:43
[TOC] pandas模块简介 pandas是python数据分析的核心模块。它主要提供了五大功能: 支持文件存取操作,支持数据库(sql)、html、json、pickle、csv(txt、excel)、sas、stata、hdf等。 支持增删改查、切片、高阶函数、分组聚合等单表操作,以及和dict、list的互相转换。 支持多表拼接合并操作。 支持简单的绘图操作。 支持简单的统计分析操作。 Series数据结构 Series是一种类似于一维数组的对象,由一组数据和一组与之相关的数据标签(索引)组成。 Series比较像列表(数组)和字典的结合体 import numpy as np import pandas as pd Series创建方式 第一种: 直接传入一个列表,此时由于没有指定数据索引,则会自动创建一个0~N-1(N为数据的长度)的整型索引,可以通过索引进行取值 df = pd.Series([i for i in range(4, 8)]) df 0 4 1 5 2 6 3 7 dtype: int64 df[1] 5 df.values array([4, 5, 6, 7], dtype=int64) 第二种:传入一个列表,自定义索引列表(索引列表长度需要和数据的长度一致),此时就可以通过自定义的索引进行取值, 但还是可以通过默认索引进行取值 df1 = pd

python numpy常用的数学和统计函数

一笑奈何 提交于 2019-12-02 08:46:00
numpy模块的核心就是基于数组的运算,相比于列表和其他数据结构,数组的运算效率是最高的。在统计分析和挖掘过程中,经常会使用到numpy模块的函数,以下是常用的数学函数和统计函数: 常数p就是圆周率 3.1415926... 常数e :2.71828... np.fabs(arr) 例如:np.fabs(-3) 输出:3.0 np.ceil(arr) 例如:np.ceil(3.2) 输出:4.0 并非四舍五入操作 np.floor(arr) 类似ceil 向下取整 np.round(arr) 四舍五入 例如:np.round(3.4) 输入:3.0 输出的还是浮点型数据,并非整型 np.fmod(arr1,arr2) 求余,对arr1,arr2并没有要求要整数,如np.fmod(3.9,3.8) 结果是:0.1000000 np.modf(arrj) 返回数组元素的小数部分和整数部分 如:arr1 = np.array([3.21,4.1,5.2]) print(np.modf(arr1)) 输出如下: (array([0.31, 0.1 , 0.2 ]), array([2., 4., 5.])) np.sqrt(arr) 计算各元素的算数平方根,这个元素可以是具体的数值,也可以是数组,例如:print(np.sqrt(arr1)) out: [1.51986842 2

Python中的numpy常用函数整理

十年热恋 提交于 2019-12-02 08:10:30
导入numpy: import numpy as np 一、numpy常用函数 1.数组生成函数 np.array(x):将x转化为一个数组 np.array(x,dtype):将x转化为一个类型为type的数组 np.zeros(shape):生成shape维度大小的全0数组 np.zeros_like(a):生成与a各维度大小一致的全0数组 np.ones(shape):生成shape维度大小的全1数组 np.ones_like(a):生成与a各维度大小一致的全1数组 np.full(shape,val):生成shape维度大小的全val数组 np.full_like(a,val):生成与a各维度大小一致的全val数组 np.empty(shape):生成shape维度大小的未初始化数组 np.empty_like(a):与np.zeros_like(a)作用类似 np.eye(n):生成n×n的单位矩阵 np.identity(n):生成n×n的单位矩阵 np.arange(begin,end,step):生成一个从begin到end-step的步长为step的一维数组,其中begin(默认0),step(默认1)可省略 np.linspace(start,stop,num):生成一个含num个元素的等差数列,start为第一个元素,stop为最后一个元素 np.where

python scatter plot area size proportional axis length

自闭症网瘾萝莉.ら 提交于 2019-12-02 06:45:15
I'm getting quite desperate about this, I couldn't find anything on the www so far. Here's the situation: I am working with Python. I have 3 arrays: the x-coordinates, the y-coordinates and the radius. I want to create a scatter plot with the given x- and y-coordinates. So far, everything works how I want it to. Here is what's bothering me: The circle size of each point in the scatter plot should be defined by the radius array. The the values of the coordinates and the radius are in same units. More explicitly: Let's assume I have a point at (1, 1) with radius 0.5 assigned. Then I want to get

Numpy | 17 统计函数

Deadly 提交于 2019-12-02 06:32:47
NumPy 提供了很多统计函数,用于从数组中查找最小元素,最大元素,百分位标准差和方差等。 带轴向就是计算整行或整列的最大值和最小值,不带轴向,就是整个数组的最大值和最小值 numpy.amin() 和 numpy.amax() numpy.amin() 用于计算数组中的元素沿指定轴的最小值。 numpy.amax() 用于计算数组中的元素沿指定轴的最大值。 import numpy as np a = np.array([[3, 7, 5], [8, 4, 3], [2, 4, 9]]) print('我们的数组是:') print(a) print('\n') print('调用 amin() 函数:') print(np.amin(a, 1)) print('\n') print('再次调用 amin() 函数:') print(np.amin(a, 0)) print('\n') print('调用 amax() 函数:') print(np.amax(a, 1)) print('\n') print('再次调用 amax() 函数:') print(np.amax(a, axis=0)) print('\n') print('整个数组中最大和最小值为:') print(np.amin(a),np.amax(a)) 输出结果为: 我们的数组是: [[3 7 5] [8 4

8个Python高效数据分析的技巧

天大地大妈咪最大 提交于 2019-12-02 05:28:37
一行代码定义List 定义某种列表时,写For 循环过于麻烦,幸运的是,Python有一种内置的方法可以在一行代码中解决这个问题。 下面是使用For循环创建列表和用一行代码创建列表的对比。 很多人学习python,掌握了基本语法过后,不知道在哪里寻找案例上手。 很多已经做案例的人,却不知道如何去学习更加高深的知识。 那么针对这三类人,我给大家提供一个好的学习平台,免费领取视频教程,电子书籍,以及课程的源代码! QQ群:127341871 x = [1,2,3,4] out = [] for item in x: out.append(item**2) print(out) [1, 4, 9, 16] # vs. x = [1,2,3,4] out = [item**2 for item in x] print(out) [1, 4, 9, 16] Lambda表达式 厌倦了定义用不了几次的函数?Lambda表达式是你的救星!Lambda表达式用于在Python中创建小型,一次性和匿名函数对象。它能替你创建一个函数。 lambda表达式的基本语法是: lambda arguments: expression 请注意,只要有一个lambda表达式,就可以完成常规函数可以执行的任何操作。你可以从下面的例子中,感受lambda表达式的强大功能: double = lambda x: x *

matplotlib 3d plot with changing labels

孤人 提交于 2019-12-02 05:04:39
问题 So I have a 3d live-updating graph! it only shows one point at a time so I can easily track the motion of the point! But here is the problem: No matter what I seem to do, the point is always placed in the center of the graph and the tick marks on the axis change in order to do that. This makes my life very difficult because I don't see the motion on the point. Here is my code: from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from pylab import * import time import pandas